MCPcopy
hub / github.com/pydantic/pydantic / test_iso_timedelta_simple

Function test_iso_timedelta_simple

tests/test_json.py:229–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

227
228
229def test_iso_timedelta_simple():
230 class Model(BaseModel):
231 x: timedelta
232
233 m = Model(x=123)
234 json_data = m.model_dump_json()
235 assert json_data == '{"x":"PT2M3S"}'
236 assert Model.model_validate_json(json_data).x == timedelta(seconds=123)
237
238
239def test_con_decimal_encode() -> None:

Callers

nothing calls this directly

Calls 3

model_dump_jsonMethod · 0.80
model_validate_jsonMethod · 0.80
ModelClass · 0.70

Tested by

no test coverage detected