1
0
mirror of https://github.com/hwchase17/langchain.git synced 2025-05-04 14:48:07 +00:00

langchain-tests: allow subclasses to add addition, non-standard tests ()

**description:** the ChatModel[Integration]Tests classes are powerful
and helpful, this change allows sub-classes to add additional tests.

for instance,

```
class TestChatMyServiceIntegration(ChatModelIntegrationTests):
    ...
    def test_myservice(self, model: BaseChatModel) -> None:
        ...
```

---------

Co-authored-by: ccurme <chester.curme@gmail.com>
This commit is contained in:
Matthew Farrellee 2025-03-17 18:37:16 -05:00 committed by GitHub
parent 789db7398b
commit 1985aaf095
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,14 +41,12 @@ class BaseStandardTests(ABC):
base_tests = set(
[method for method in dir(comparison_class) if method.startswith("test_")]
)
non_standard_tests = running_tests - base_tests
assert not non_standard_tests, f"Non-standard tests found: {non_standard_tests}"
deleted_tests = base_tests - running_tests
assert not deleted_tests, f"Standard tests deleted: {deleted_tests}"
overridden_tests = [
method
for method in running_tests
for method in base_tests
if getattr(self.__class__, method) is not getattr(comparison_class, method)
]