test_debug_is_settable_via_setter() — langchain Function Reference
Architecture documentation for the test_debug_is_settable_via_setter() function in test_globals.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD b483e09c_4d0a_9d8c_93b8_2c86f6081005["test_debug_is_settable_via_setter()"] d15e95c4_3344_c8ce_47d5_14e082f95cb5["test_globals.py"] b483e09c_4d0a_9d8c_93b8_2c86f6081005 -->|defined in| d15e95c4_3344_c8ce_47d5_14e082f95cb5 style b483e09c_4d0a_9d8c_93b8_2c86f6081005 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/test_globals.py lines 25–52
def test_debug_is_settable_via_setter() -> None:
from langchain_core import globals as langchain_globals
from langchain_core.callbacks.manager import _get_debug
previous_value = langchain_globals._debug
previous_fn_reading = _get_debug()
assert previous_value == previous_fn_reading
# Flip the value of the flag.
set_debug(not previous_value)
new_value = langchain_globals._debug
new_fn_reading = _get_debug()
try:
# We successfully changed the value of `debug`.
assert new_value != previous_value
# If we access `debug` via a function used elsewhere in langchain,
# it also sees the same new value.
assert new_value == new_fn_reading
# If we access `debug` via `get_debug()` we also get the same value.
assert new_value == get_debug()
finally:
# Make sure we don't alter global state, even if the test fails.
# Always reset `debug` to the value it had before.
set_debug(previous_value)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_debug_is_settable_via_setter() do?
test_debug_is_settable_via_setter() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/test_globals.py.
Where is test_debug_is_settable_via_setter() defined?
test_debug_is_settable_via_setter() is defined in libs/langchain/tests/unit_tests/test_globals.py at line 25.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free