MCPcopy
hub / github.com/pydantic/pydantic / test_computed_fields_repr

Function test_computed_fields_repr

tests/test_computed_fields.py:243–257  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

241
242
243def test_computed_fields_repr():
244 class Model(BaseModel):
245 x: int
246
247 @computed_field(repr=False)
248 @property
249 def double(self) -> int:
250 return self.x * 2
251
252 @computed_field # repr=True by default
253 @property
254 def triple(self) -> int:
255 return self.x * 3
256
257 assert repr(Model(x=2)) == 'Model(x=2, triple=6)'
258
259
260def test_functools():

Callers

nothing calls this directly

Calls 1

ModelClass · 0.70

Tested by

no test coverage detected