Home / Function/ test_no_cache_async() — langchain Function Reference

test_no_cache_async() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/language_models/chat_models/test_cache.py lines 173–187

async def test_no_cache_async() -> None:
    global_cache = InMemoryCache()
    try:
        set_llm_cache(global_cache)
        chat_model = FakeListChatModel(
            cache=False, responses=["hello", "goodbye"]
        )  # Set cache=False
        assert (await chat_model.ainvoke("How are you?")).content == "hello"
        # The global cache should not be populated since cache=False
        # so we should get the second response
        assert (await chat_model.ainvoke("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_async() do?
test_no_cache_async() 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_async() defined?
test_no_cache_async() is defined in libs/core/tests/unit_tests/language_models/chat_models/test_cache.py at line 173.

Analyze Your Own Codebase

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

Try Supermodel Free