()
| 436 | |
| 437 | |
| 438 | def test_iso8601_datetime() -> None: |
| 439 | class Model(BaseModel): |
| 440 | created_at: datetime |
| 441 | |
| 442 | expected = datetime(2019, 12, 27, 18, 11, 19, 117000, tzinfo=timezone.utc) |
| 443 | |
| 444 | if PYDANTIC_V1: |
| 445 | expected_json = '{"created_at": "2019-12-27T18:11:19.117000+00:00"}' |
| 446 | else: |
| 447 | expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' |
| 448 | |
| 449 | model = Model.construct(created_at="2019-12-27T18:11:19.117Z") |
| 450 | assert model.created_at == expected |
| 451 | assert model_json(model) == expected_json |
| 452 | |
| 453 | model = parse_obj(Model, dict(created_at="2019-12-27T18:11:19.117Z")) |
| 454 | assert model.created_at == expected |
| 455 | assert model_json(model) == expected_json |
| 456 | |
| 457 | |
| 458 | def test_does_not_coerce_int() -> None: |
nothing calls this directly
no test coverage detected