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

Function test_omitted_fields

tests/test_models.py:505–519  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

503
504
505def test_omitted_fields() -> None:
506 class Model(BaseModel):
507 resource_id: Optional[str] = None
508
509 m = Model.construct()
510 assert m.resource_id is None
511 assert "resource_id" not in m.model_fields_set
512
513 m = Model.construct(resource_id=None)
514 assert m.resource_id is None
515 assert "resource_id" in m.model_fields_set
516
517 m = Model.construct(resource_id="foo")
518 assert m.resource_id == "foo"
519 assert "resource_id" in m.model_fields_set
520
521
522def test_to_dict() -> None:

Callers

nothing calls this directly

Calls 1

constructMethod · 0.45

Tested by

no test coverage detected