mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 14:49:29 +00:00
langchain-tests: allow test_serdes for packages outside the default valid namespaces (#30343)
**Description:** a third party package not listed in the default valid namespaces cannot pass test_serdes because the load() does not allow for extending the valid_namespaces. test_serdes will fail with - ValueError: Invalid namespace: {'lc': 1, 'type': 'constructor', 'id': ['langchain_other', 'chat_models', 'ChatOther'], 'kwargs': {'model_name': '...', 'api_key': '...'}, 'name': 'ChatOther'} this change has test_serdes automatically extend valid_namespaces based off the ChatModel under test's namespace.
This commit is contained in:
parent
699475a01d
commit
e7032901c3
@ -717,4 +717,9 @@ class ChatModelUnitTests(ChatModelTests):
|
||||
with mock.patch.dict(os.environ, env_params):
|
||||
ser = dumpd(model)
|
||||
assert ser == snapshot(name="serialized")
|
||||
assert model.dict() == load(dumpd(model)).dict()
|
||||
assert (
|
||||
model.dict()
|
||||
== load(
|
||||
dumpd(model), valid_namespaces=model.get_lc_namespace()[:1]
|
||||
).dict()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user