Home / Function/ test_no_cache_sync() — langchain Function Reference

test_no_cache_sync() — langchain Function Reference

Architecture documentation for the test_no_cache_sync() function in test_cache.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  9bcdb0cd_d912_eaaf_09c3_94e978a41ab3["test_no_cache_sync()"]
  51f634bf_713d_3f19_d694_5c6ef3e59c57["test_cache.py"]
  9bcdb0cd_d912_eaaf_09c3_94e978a41ab3 -->|defined in| 51f634bf_713d_3f19_d694_5c6ef3e59c57
  style 9bcdb0cd_d912_eaaf_09c3_94e978a41ab3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/language_models/chat_models/test_cache.py lines 156–170

def test_no_cache_sync() -> None:
    global_cache = InMemoryCache()
    try:
        set_llm_cache(global_cache)
        chat_model = FakeListChatModel(
            cache=False, responses=["hello", "goodbye"]
        )  # Set cache=False
        assert (chat_model.invoke("How are you?")).content == "hello"
        # The global cache should not be populated since cache=False
        # so we should get the second response
        assert (chat_model.invoke("How are you?")).content == "goodbye"
        # The global cache should not be populated since cache=False
        assert len(global_cache._cache) == 0
    finally:
        set_llm_cache(None)

Subdomains

Frequently Asked Questions

What does test_no_cache_sync() do?
test_no_cache_sync() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/language_models/chat_models/test_cache.py.
Where is test_no_cache_sync() defined?
test_no_cache_sync() is defined in libs/core/tests/unit_tests/language_models/chat_models/test_cache.py at line 156.

Analyze Your Own Codebase

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

Try Supermodel Free