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

Function test_iso8601_datetime

tests/test_models.py:423–440  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

421
422
423def test_iso8601_datetime() -> None:
424 class Model(BaseModel):
425 created_at: datetime
426
427 expected = datetime(2019, 12, 27, 18, 11, 19, 117000, tzinfo=timezone.utc)
428
429 if PYDANTIC_V2:
430 expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}'
431 else:
432 expected_json = '{"created_at": "2019-12-27T18:11:19.117000+00:00"}'
433
434 model = Model.construct(created_at="2019-12-27T18:11:19.117Z")
435 assert model.created_at == expected
436 assert model_json(model) == expected_json
437
438 model = parse_obj(Model, dict(created_at="2019-12-27T18:11:19.117Z"))
439 assert model.created_at == expected
440 assert model_json(model) == expected_json
441
442
443def test_does_not_coerce_int() -> None:

Callers

nothing calls this directly

Calls 3

model_jsonFunction · 0.90
parse_objFunction · 0.90
constructMethod · 0.45

Tested by

no test coverage detected