(value, expected)
| 23 | ], |
| 24 | ) |
| 25 | def test_complex_json(value, expected): |
| 26 | v = SchemaSerializer(core_schema.complex_schema()) |
| 27 | c = v.to_python(value) |
| 28 | c_json = v.to_python(value, mode='json') |
| 29 | json_str = v.to_json(value).decode() |
| 30 | |
| 31 | assert c_json == expected |
| 32 | assert json_str == f'"{expected}"' |
| 33 | |
| 34 | if math.isnan(value.imag): |
| 35 | assert math.isnan(c.imag) |
| 36 | else: |
| 37 | assert c.imag == value.imag |
| 38 | |
| 39 | if math.isnan(value.real): |
| 40 | assert math.isnan(c.real) |
| 41 | else: |
| 42 | assert c.real == value.real |
| 43 | |
| 44 | |
| 45 | def test_complex_inference() -> None: |
nothing calls this directly
no test coverage detected