MCPcopy
hub / github.com/openai/openai-python / test_unknown_fields

Function test_unknown_fields

tests/test_models.py:149–158  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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