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

Function test_deprecated_alias

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

Source from the content-addressed store, hash-verified

503
504
505def test_deprecated_alias() -> None:
506 class Model(BaseModel):
507 resource_id: str = Field(alias="model_id")
508
509 @property
510 def model_id(self) -> str:
511 return self.resource_id
512
513 m = Model.construct(model_id="id")
514 assert m.model_id == "id"
515 assert m.resource_id == "id"
516 assert m.resource_id is m.model_id
517
518 m = parse_obj(Model, {"model_id": "id"})
519 assert m.model_id == "id"
520 assert m.resource_id == "id"
521 assert m.resource_id is m.model_id
522
523
524def test_omitted_fields() -> None:

Callers

nothing calls this directly

Calls 2

parse_objFunction · 0.90
constructMethod · 0.45

Tested by

no test coverage detected