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

Function test_nested_dictionary_model

tests/test_models.py:135–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

133
134
135def test_nested_dictionary_model() -> None:
136 class NestedModel(BaseModel):
137 nested: Dict[str, BasicModel]
138
139 m = NestedModel.construct(nested={"hello": {"foo": "bar"}})
140 assert isinstance(m.nested, dict)
141 assert m.nested["hello"].foo == "bar"
142
143 # mismatched types
144 m = NestedModel.construct(nested={"hello": False})
145 assert cast(Any, m.nested["hello"]) is False
146
147
148def test_unknown_fields() -> None:

Callers

nothing calls this directly

Calls 1

constructMethod · 0.45

Tested by

no test coverage detected