Home / Function/ test_debug_is_settable_via_setter() — langchain Function Reference

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
  0058017e_95b1_9256_8194_2487d751150e["test_debug_is_settable_via_setter()"]
  369a7f7f_397d_dfc9_0b8c_0b3de4f46f0e["test_globals.py"]
  0058017e_95b1_9256_8194_2487d751150e -->|defined in| 369a7f7f_397d_dfc9_0b8c_0b3de4f46f0e
  style 0058017e_95b1_9256_8194_2487d751150e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_globals.py lines 6–30

def test_debug_is_settable_via_setter() -> None:
    previous_value = langchain_core.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_core.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)

Subdomains

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/core/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/core/tests/unit_tests/test_globals.py at line 6.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free