MCPcopy
hub / github.com/openai/openai-python / test_deprecated_alias

Function test_deprecated_alias

tests/test_models.py:472–488  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

parse_objFunction · 0.90
constructMethod · 0.45

Tested by

no test coverage detected