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

Function test_directly_nested_model

tests/test_models.py:26–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24
25
26def test_directly_nested_model() -> None:
27 class NestedModel(BaseModel):
28 nested: BasicModel
29
30 m = NestedModel.construct(nested={"foo": "Foo!"})
31 assert m.nested.foo == "Foo!"
32
33 # mismatched types
34 m = NestedModel.construct(nested="hello!")
35 assert cast(Any, m.nested) == "hello!"
36
37
38def test_optional_nested_model() -> None:

Callers

nothing calls this directly

Calls 1

constructMethod · 0.45

Tested by

no test coverage detected