MCPcopy Create free account
hub / github.com/anomalyco/opencode-sdk-python / test_unknown_fields

Function test_unknown_fields

tests/test_models.py:148–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146
147
148def test_unknown_fields() -> None:
149 m1 = BasicModel.construct(foo="foo", unknown=1)
150 assert m1.foo == "foo"
151 assert cast(Any, m1).unknown == 1
152
153 m2 = BasicModel.construct(foo="foo", unknown={"foo_bar": True})
154 assert m2.foo == "foo"
155 assert cast(Any, m2).unknown == {"foo_bar": True}
156
157 assert model_dump(m2) == {"foo": "foo", "unknown": {"foo_bar": True}}
158
159
160def 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