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

Function test_omitted_fields

tests/test_models.py:524–538  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

522
523
524def test_omitted_fields() -> None:
525 class Model(BaseModel):
526 resource_id: Optional[str] = None
527
528 m = Model.construct()
529 assert m.resource_id is None
530 assert "resource_id" not in m.model_fields_set
531
532 m = Model.construct(resource_id=None)
533 assert m.resource_id is None
534 assert "resource_id" in m.model_fields_set
535
536 m = Model.construct(resource_id="foo")
537 assert m.resource_id == "foo"
538 assert "resource_id" in m.model_fields_set
539
540
541def test_to_dict() -> None:

Callers

nothing calls this directly

Calls 1

constructMethod · 0.45

Tested by

no test coverage detected