mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-05 07:08:03 +00:00
langchain-tests: allow subclasses to add addition, non-standard tests (#30204)
**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:
parent
789db7398b
commit
1985aaf095
@ -41,14 +41,12 @@ class BaseStandardTests(ABC):
|
|||||||
base_tests = set(
|
base_tests = set(
|
||||||
[method for method in dir(comparison_class) if method.startswith("test_")]
|
[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
|
deleted_tests = base_tests - running_tests
|
||||||
assert not deleted_tests, f"Standard tests deleted: {deleted_tests}"
|
assert not deleted_tests, f"Standard tests deleted: {deleted_tests}"
|
||||||
|
|
||||||
overridden_tests = [
|
overridden_tests = [
|
||||||
method
|
method
|
||||||
for method in running_tests
|
for method in base_tests
|
||||||
if getattr(self.__class__, method) is not getattr(comparison_class, method)
|
if getattr(self.__class__, method) is not getattr(comparison_class, method)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user