test_sync_callback_manager.py — langchain Source File
Architecture documentation for test_sync_callback_manager.py, a python file in the langchain codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 748ec2b4_9c22_8e40_5174_c4bd290fcb4d["test_sync_callback_manager.py"] 7e64d143_ea36_1c73_4897_1d0ae1757b5b["langchain_core.callbacks.base"] 748ec2b4_9c22_8e40_5174_c4bd290fcb4d --> 7e64d143_ea36_1c73_4897_1d0ae1757b5b style 748ec2b4_9c22_8e40_5174_c4bd290fcb4d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from langchain_core.callbacks.base import BaseCallbackHandler, BaseCallbackManager
def test_remove_handler() -> None:
"""Test removing handler does not raise an error on removal.
An handler can be inheritable or not. This test checks that
removing a handler does not raise an error if the handler
is not inheritable.
"""
handler1 = BaseCallbackHandler()
handler2 = BaseCallbackHandler()
manager = BaseCallbackManager([handler1], inheritable_handlers=[handler2])
manager.remove_handler(handler1)
manager.remove_handler(handler2)
def test_merge_preserves_handler_distinction() -> None:
"""Test that merging managers preserves the distinction between handlers.
This test verifies the correct behavior of the BaseCallbackManager.merge()
method. When two managers are merged, their handlers and
inheritable_handlers should be combined independently.
Currently, it is expected to xfail until the issue is resolved.
"""
h1 = BaseCallbackHandler()
h2 = BaseCallbackHandler()
ih1 = BaseCallbackHandler()
ih2 = BaseCallbackHandler()
m1 = BaseCallbackManager(handlers=[h1], inheritable_handlers=[ih1])
m2 = BaseCallbackManager(handlers=[h2], inheritable_handlers=[ih2])
merged = m1.merge(m2)
assert set(merged.handlers) == {h1, h2}
assert set(merged.inheritable_handlers) == {ih1, ih2}
Domain
Subdomains
Dependencies
- langchain_core.callbacks.base
Source
Frequently Asked Questions
What does test_sync_callback_manager.py do?
test_sync_callback_manager.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in test_sync_callback_manager.py?
test_sync_callback_manager.py defines 2 function(s): test_merge_preserves_handler_distinction, test_remove_handler.
What does test_sync_callback_manager.py depend on?
test_sync_callback_manager.py imports 1 module(s): langchain_core.callbacks.base.
Where is test_sync_callback_manager.py in the architecture?
test_sync_callback_manager.py is located at libs/core/tests/unit_tests/callbacks/test_sync_callback_manager.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/tests/unit_tests/callbacks).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free