MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / test_unknown_fields

Function test_unknown_fields

tests/test_models.py:163–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

161
162
163def test_unknown_fields() -> None:
164 m1 = BasicModel.construct(foo="foo", unknown=1)
165 assert m1.foo == "foo"
166 assert cast(Any, m1).unknown == 1
167
168 m2 = BasicModel.construct(foo="foo", unknown={"foo_bar": True})
169 assert m2.foo == "foo"
170 assert cast(Any, m2).unknown == {"foo_bar": True}
171
172 assert model_dump(m2) == {"foo": "foo", "unknown": {"foo_bar": True}}
173
174
175def test_strict_validation_unknown_fields() -> None:

Callers

nothing calls this directly

Calls 2

model_dumpFunction · 0.90
constructMethod · 0.45

Tested by

no test coverage detected