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

Function test_deprecated_alias

tests/test_models.py:471–487  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

469
470
471def test_deprecated_alias() -> None:
472 class Model(BaseModel):
473 resource_id: str = Field(alias="model_id")
474
475 @property
476 def model_id(self) -> str:
477 return self.resource_id
478
479 m = Model.construct(model_id="id")
480 assert m.model_id == "id"
481 assert m.resource_id == "id"
482 assert m.resource_id is m.model_id
483
484 m = parse_obj(Model, {"model_id": "id"})
485 assert m.model_id == "id"
486 assert m.resource_id == "id"
487 assert m.resource_id is m.model_id
488
489
490def test_omitted_fields() -> None:

Callers

nothing calls this directly

Calls 2

parse_objFunction · 0.90
constructMethod · 0.45

Tested by

no test coverage detected