Skip to content

Commit c3c00fb

Browse files
committed
cleanup
1 parent f2e1f6d commit c3c00fb

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

libs/langchain-mongodb/tests/integration_tests/test_cache.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def llm_cache(cls: Any) -> BaseCache:
7070
)
7171
)
7272
assert get_llm_cache()
73-
return get_llm_cache()
73+
return get_llm_cache() # type:ignore[return-value]
7474

7575

7676
@pytest.fixture(scope="module", autouse=True)
@@ -99,7 +99,7 @@ def _execute_test(
9999
dumped_prompt: str = prompt if isinstance(prompt, str) else dumps(prompt)
100100

101101
# Update the cache
102-
get_llm_cache().update(dumped_prompt, llm_string, response)
102+
get_llm_cache().update(dumped_prompt, llm_string, response) # type:ignore[union-attr]
103103

104104
# Retrieve the cached result through 'generate' call
105105
output: Union[List[Generation], LLMResult, None]
@@ -156,8 +156,8 @@ def test_mongodb_cache(
156156
try:
157157
_execute_test(prompt, llm, response)
158158
finally:
159-
get_llm_cache().clear()
160-
get_llm_cache().close() # type:ignore[attr-defined]
159+
get_llm_cache().clear() # type:ignore[union-attr]
160+
get_llm_cache().close() # type:ignore[attr-defined,union-attr]
161161

162162

163163
@pytest.mark.parametrize(
@@ -208,5 +208,5 @@ def test_mongodb_atlas_cache_matrix(
208208
assert llm.generate(prompts) == LLMResult(
209209
generations=llm_generations, llm_output={}
210210
)
211-
get_llm_cache().clear()
212-
get_llm_cache().close() # type:ignore[attr-defined]
211+
get_llm_cache().clear() # type:ignore[union-attr]
212+
get_llm_cache().close() # type:ignore[attr-defined,union-attr]

libs/langchain-mongodb/tests/unit_tests/test_cache.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def llm_cache(cls: Any) -> BaseCache:
8181
)
8282
)
8383
assert get_llm_cache()
84-
return get_llm_cache()
84+
return get_llm_cache() # type:ignore[return-value]
8585

8686

8787
@pytest.fixture(scope="module", autouse=True)
@@ -111,6 +111,7 @@ def _execute_test(
111111

112112
# Update the cache
113113
llm_cache = get_llm_cache()
114+
assert llm_cache is not None
114115
llm_cache.update(dumped_prompt, llm_string, response)
115116

116117
# Retrieve the cached result through 'generate' call
@@ -175,7 +176,7 @@ def test_mongodb_cache(
175176
try:
176177
_execute_test(prompt, llm, response)
177178
finally:
178-
get_llm_cache().clear()
179+
get_llm_cache().clear() # type:ignore[union-attr]
179180

180181

181182
@pytest.mark.parametrize(
@@ -227,4 +228,4 @@ def test_mongodb_atlas_cache_matrix(
227228
assert llm.generate(prompts) == LLMResult(
228229
generations=llm_generations, llm_output={}
229230
)
230-
get_llm_cache().clear()
231+
get_llm_cache().clear() # type:ignore[union-attr]

0 commit comments

Comments
 (0)