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

Function test_deprecated_alias

tests/test_models.py:486–502  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

484
485
486def test_deprecated_alias() -> None:
487 class Model(BaseModel):
488 resource_id: str = Field(alias="model_id")
489
490 @property
491 def model_id(self) -> str:
492 return self.resource_id
493
494 m = Model.construct(model_id="id")
495 assert m.model_id == "id"
496 assert m.resource_id == "id"
497 assert m.resource_id is m.model_id
498
499 m = parse_obj(Model, {"model_id": "id"})
500 assert m.model_id == "id"
501 assert m.resource_id == "id"
502 assert m.resource_id is m.model_id
503
504
505def test_omitted_fields() -> None:

Callers

nothing calls this directly

Calls 2

parse_objFunction · 0.90
constructMethod · 0.45

Tested by

no test coverage detected