Skip to content

Commit c6547f5

Browse files
authored
style(standard-tests): refs pass (#33814)
1 parent dfb05a7 commit c6547f5

File tree

5 files changed

+42
-52
lines changed

5 files changed

+42
-52
lines changed

libs/standard-tests/langchain_tests/integration_tests/cache.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def get_sample_llm_string(self) -> str:
4141
return "Sample LLM string configuration."
4242

4343
def get_sample_generation(self) -> Generation:
44-
"""Return a sample Generation object for testing."""
44+
"""Return a sample `Generation` object for testing."""
4545
return Generation(
4646
text="Sample generated text.",
4747
generation_info={"reason": "test"},
@@ -66,8 +66,8 @@ def test_cache_still_empty(self, cache: BaseCache) -> None:
6666
6767
This test should follow a test that updates the cache.
6868
69-
This just verifies that the fixture is set up properly to be empty
70-
after each test.
69+
This just verifies that the fixture is set up properly to be empty after each
70+
test.
7171
"""
7272
assert (
7373
cache.lookup(self.get_sample_prompt(), self.get_sample_llm_string()) is None
@@ -95,7 +95,7 @@ def test_cache_hit(self, cache: BaseCache) -> None:
9595
assert cache.lookup(prompt, llm_string) == [generation]
9696

9797
def test_update_cache_with_multiple_generations(self, cache: BaseCache) -> None:
98-
"""Test updating the cache with multiple Generation objects."""
98+
"""Test updating the cache with multiple `Generation` objects."""
9999
prompt = self.get_sample_prompt()
100100
llm_string = self.get_sample_llm_string()
101101
generations = [
@@ -113,8 +113,8 @@ class AsyncCacheTestSuite(BaseStandardTests):
113113
114114
The test suite is designed for synchronous caching layers.
115115
116-
Implementers should subclass this test suite and provide a fixture
117-
that returns an empty cache for each test.
116+
Implementers should subclass this test suite and provide a fixture that returns an
117+
empty cache for each test.
118118
"""
119119

120120
@abstractmethod
@@ -134,7 +134,7 @@ def get_sample_llm_string(self) -> str:
134134
return "Sample LLM string configuration."
135135

136136
def get_sample_generation(self) -> Generation:
137-
"""Return a sample Generation object for testing."""
137+
"""Return a sample `Generation` object for testing."""
138138
return Generation(
139139
text="Sample generated text.",
140140
generation_info={"reason": "test"},
@@ -160,8 +160,8 @@ async def test_cache_still_empty(self, cache: BaseCache) -> None:
160160
161161
This test should follow a test that updates the cache.
162162
163-
This just verifies that the fixture is set up properly to be empty
164-
after each test.
163+
This just verifies that the fixture is set up properly to be empty after each
164+
test.
165165
"""
166166
assert (
167167
await cache.alookup(self.get_sample_prompt(), self.get_sample_llm_string())
@@ -196,7 +196,7 @@ async def test_update_cache_with_multiple_generations(
196196
self,
197197
cache: BaseCache,
198198
) -> None:
199-
"""Test updating the cache with multiple Generation objects."""
199+
"""Test updating the cache with multiple `Generation` objects."""
200200
prompt = self.get_sample_prompt()
201201
llm_string = self.get_sample_llm_string()
202202
generations = [

libs/standard-tests/langchain_tests/integration_tests/chat_models.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ class ChatModelIntegrationTests(ChatModelTests):
173173
`chat_model_params` properties to specify what model to test and its
174174
initialization parameters.
175175
176-
177176
```python
178177
from typing import Type
179178
@@ -217,6 +216,7 @@ def chat_model_params(self) -> dict:
217216
218217
In addition, test subclasses can control what features are tested (such as tool
219218
calling or multi-modality) by selectively overriding the following properties.
219+
220220
Expand to see details:
221221
222222
??? info "`has_tool_calling`"
@@ -226,9 +226,7 @@ def chat_model_params(self) -> dict:
226226
By default, this is determined by whether the chat model's `bind_tools` method
227227
is overridden. It typically does not need to be overridden on the test class.
228228
229-
Example override:
230-
231-
```python
229+
```python "Example override"
232230
@property
233231
def has_tool_calling(self) -> bool:
234232
return True
@@ -264,9 +262,7 @@ def tool_choice_value(self) -> str | None:
264262
`tool_choice="any"` will force a tool call, and `tool_choice=<tool name>`
265263
will force a call to a specific tool.
266264
267-
Example override:
268-
269-
```python
265+
```python "Example override"
270266
@property
271267
def has_tool_choice(self) -> bool:
272268
return False
@@ -424,15 +420,16 @@ def supports_audio_inputs(self) -> bool:
424420
return True
425421
```
426422
427-
Note: this test downloads audio data from wikimedia.org. You may need to set
428-
the `LANGCHAIN_TESTS_USER_AGENT` environment variable to identify these
429-
requests, e.g.,
423+
!!! warning
424+
This test downloads audio data from wikimedia.org. You may need to set the
425+
`LANGCHAIN_TESTS_USER_AGENT` environment variable to identify these tests,
426+
e.g.,
430427
431-
```bash
432-
export LANGCHAIN_TESTS_USER_AGENT="CoolBot/0.0 (https://example.org/coolbot/; [email protected]) generic-library/0.0"
433-
```
428+
```bash
429+
export LANGCHAIN_TESTS_USER_AGENT="CoolBot/0.0 (https://example.org/coolbot/; [email protected]) generic-library/0.0"
430+
```
434431
435-
Refer to the [Wikimedia Foundation User-Agent Policy](https://foundation.wikimedia.org/wiki/Policy:Wikimedia_Foundation_User-Agent_Policy).
432+
Refer to the [Wikimedia Foundation User-Agent Policy](https://foundation.wikimedia.org/wiki/Policy:Wikimedia_Foundation_User-Agent_Policy).
436433
437434
??? info "`supports_video_inputs`"
438435
@@ -459,8 +456,8 @@ def returns_usage_metadata(self) -> bool:
459456
return False
460457
```
461458
462-
Models supporting `usage_metadata` should also return the name of the
463-
underlying model in the `response_metadata` of the `AIMessage`.
459+
Models supporting `usage_metadata` should also return the name of the underlying
460+
model in the `response_metadata` of the `AIMessage`.
464461
465462
??? info "`supports_anthropic_inputs`"
466463
@@ -724,7 +721,6 @@ def pytest_recording_configure(config: dict, vcr: VCR) -> None:
724721
725722
You can then commit the cassette to your repository. Subsequent test runs
726723
will use the cassette instead of making HTTP calls.
727-
728724
''' # noqa: E501,D214
729725

730726
@property

libs/standard-tests/langchain_tests/integration_tests/indexer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""Test suite to check index implementations.
22
3-
Standard tests for the DocumentIndex abstraction
3+
Standard tests for the `DocumentIndex` abstraction
44
5-
We don't recommend implementing externally managed DocumentIndex abstractions at this
5+
We don't recommend implementing externally managed `DocumentIndex` abstractions at this
66
time.
77
"""
88

@@ -19,8 +19,8 @@
1919
class DocumentIndexerTestSuite(ABC):
2020
"""Test suite for checking the read-write of a document index.
2121
22-
Implementers should subclass this test suite and provide a fixture
23-
that returns an empty index for each test.
22+
Implementers should subclass this test suite and provide a fixture that returns an
23+
empty index for each test.
2424
"""
2525

2626
@abstractmethod
@@ -172,7 +172,7 @@ def test_bulk_delete(self, index: DocumentIndex) -> None:
172172
]
173173

174174
def test_delete_no_args(self, index: DocumentIndex) -> None:
175-
"""Test delete with no args raises ValueError."""
175+
"""Test delete with no args raises `ValueError`."""
176176
with pytest.raises(ValueError): # noqa: PT011
177177
index.delete()
178178

@@ -364,7 +364,7 @@ async def test_bulk_delete(self, index: DocumentIndex) -> None:
364364
]
365365

366366
async def test_delete_no_args(self, index: DocumentIndex) -> None:
367-
"""Test delete with no args raises ValueError."""
367+
"""Test delete with no args raises `ValueError`."""
368368
with pytest.raises(ValueError): # noqa: PT011
369369
await index.adelete()
370370

libs/standard-tests/langchain_tests/integration_tests/vectorstores.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Test suite to test vectostores."""
1+
"""Test suite to test `VectorStore` integrations."""
22

33
from abc import abstractmethod
44

@@ -95,7 +95,6 @@ def has_async(self) -> bool:
9595
9696
!!! note
9797
API references for individual test methods include troubleshooting tips.
98-
9998
""" # noqa: E501
10099

101100
@abstractmethod

libs/standard-tests/langchain_tests/unit_tests/chat_models.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ def chat_model_params(self) -> dict:
304304
305305
In addition, test subclasses can control what features are tested (such as tool
306306
calling or multi-modality) by selectively overriding the following properties.
307+
307308
Expand to see details:
308309
309310
??? info "`has_tool_calling`"
@@ -313,9 +314,7 @@ def chat_model_params(self) -> dict:
313314
By default, this is determined by whether the chat model's `bind_tools` method
314315
is overridden. It typically does not need to be overridden on the test class.
315316
316-
Example override:
317-
318-
```python
317+
```python "Example override"
319318
@property
320319
def has_tool_calling(self) -> bool:
321320
return True
@@ -350,9 +349,7 @@ def tool_choice_value(self) -> str | None:
350349
`tool_choice="any"` will force a tool call, and `tool_choice=<tool name>`
351350
will force a call to a specific tool.
352351
353-
Example override:
354-
355-
```python
352+
```python "Example override"
356353
@property
357354
def has_tool_choice(self) -> bool:
358355
return False
@@ -429,7 +426,6 @@ def supports_json_mode(self) -> bool:
429426
430427
See https://docs.langchain.com/oss/python/langchain/models#multimodal
431428
432-
433429
```python
434430
@property
435431
def supports_image_inputs(self) -> bool:
@@ -455,7 +451,6 @@ def supports_image_inputs(self) -> bool:
455451
456452
See https://docs.langchain.com/oss/python/langchain/models#multimodal
457453
458-
459454
```python
460455
@property
461456
def supports_image_urls(self) -> bool:
@@ -481,7 +476,6 @@ def supports_image_urls(self) -> bool:
481476
482477
See https://docs.langchain.com/oss/python/langchain/models#multimodal
483478
484-
485479
```python
486480
@property
487481
def supports_pdf_inputs(self) -> bool:
@@ -513,15 +507,16 @@ def supports_audio_inputs(self) -> bool:
513507
return True
514508
```
515509
516-
Note: this test downloads audio data from wikimedia.org. You may need to set
517-
the `LANGCHAIN_TESTS_USER_AGENT` environment variable to identify these
518-
requests, e.g.,
510+
!!! warning
511+
This test downloads audio data from wikimedia.org. You may need to set the
512+
`LANGCHAIN_TESTS_USER_AGENT` environment variable to identify these tests,
513+
e.g.,
519514
520-
```bash
521-
export LANGCHAIN_TESTS_USER_AGENT="CoolBot/0.0 (https://example.org/coolbot/; [email protected]) generic-library/0.0"
522-
```
515+
```bash
516+
export LANGCHAIN_TESTS_USER_AGENT="CoolBot/0.0 (https://example.org/coolbot/; [email protected]) generic-library/0.0"
517+
```
523518
524-
Refer to the [Wikimedia Foundation User-Agent Policy](https://foundation.wikimedia.org/wiki/Policy:Wikimedia_Foundation_User-Agent_Policy).
519+
Refer to the [Wikimedia Foundation User-Agent Policy](https://foundation.wikimedia.org/wiki/Policy:Wikimedia_Foundation_User-Agent_Policy).
525520
526521
??? info "`supports_video_inputs`"
527522
@@ -540,6 +535,7 @@ def supports_audio_inputs(self) -> bool:
540535
541536
`usage_metadata` is an optional dict attribute on `AIMessage` objects that track
542537
input and output tokens.
538+
543539
[See more](https://reference.langchain.com/python/langchain_core/language_models/#langchain_core.messages.ai.UsageMetadata).
544540
545541
```python
@@ -850,7 +846,6 @@ def init_from_env_params(self) -> Tuple[dict, dict, dict]:
850846
},
851847
)
852848
```
853-
854849
''' # noqa: E501,D214
855850

856851
@property

0 commit comments

Comments
 (0)