mirror of
https://github.com/hwchase17/langchain.git
synced 2026-07-01 06:42:37 +00:00
test(partners): account for warning behavior in partner tests (#38046)
Partner unit tests now reflect the warning behavior emitted by updated `langchain-core` serialization and model initialization paths. Warning-strict runs can stay focused on the behavior under test rather than expected framework warnings.
This commit is contained in:
@@ -492,6 +492,7 @@ class TestSerialization:
|
||||
"""Test that ChatOpenRouter declares itself as serializable."""
|
||||
assert ChatOpenRouter.is_lc_serializable() is True
|
||||
|
||||
@pytest.mark.filterwarnings("ignore:The function `load` is in beta")
|
||||
def test_dumpd_load_roundtrip(self) -> None:
|
||||
"""Test that dumpd/load round-trip preserves model config."""
|
||||
model = _make_model(temperature=0.7, max_tokens=100)
|
||||
|
||||
2
libs/partners/openrouter/uv.lock
generated
2
libs/partners/openrouter/uv.lock
generated
@@ -346,7 +346,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "langchain-core"
|
||||
version = "1.4.2"
|
||||
version = "1.4.4"
|
||||
source = { editable = "../../core" }
|
||||
dependencies = [
|
||||
{ name = "jsonpatch" },
|
||||
|
||||
@@ -48,12 +48,14 @@ def test_chat_xai_invalid_streaming_params() -> None:
|
||||
def test_chat_xai_extra_kwargs() -> None:
|
||||
"""Test extra kwargs to chat xai."""
|
||||
# Check that foo is saved in extra_kwargs.
|
||||
llm = ChatXAI(model=MODEL_NAME, foo=3, max_tokens=10) # type: ignore[call-arg]
|
||||
with pytest.warns(UserWarning, match="foo is not default parameter"):
|
||||
llm = ChatXAI(model=MODEL_NAME, foo=3, max_tokens=10) # type: ignore[call-arg]
|
||||
assert llm.max_tokens == 10
|
||||
assert llm.model_kwargs == {"foo": 3}
|
||||
|
||||
# Test that if extra_kwargs are provided, they are added to it.
|
||||
llm = ChatXAI(model=MODEL_NAME, foo=3, model_kwargs={"bar": 2}) # type: ignore[call-arg]
|
||||
with pytest.warns(UserWarning, match="foo is not default parameter"):
|
||||
llm = ChatXAI(model=MODEL_NAME, foo=3, model_kwargs={"bar": 2}) # type: ignore[call-arg]
|
||||
assert llm.model_kwargs == {"foo": 3, "bar": 2}
|
||||
|
||||
# Test that if provided twice it errors
|
||||
|
||||
2
libs/partners/xai/uv.lock
generated
2
libs/partners/xai/uv.lock
generated
@@ -679,7 +679,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "langchain-core"
|
||||
version = "1.4.2"
|
||||
version = "1.4.4"
|
||||
source = { editable = "../../core" }
|
||||
dependencies = [
|
||||
{ name = "jsonpatch" },
|
||||
|
||||
Reference in New Issue
Block a user