()
| 115 | |
| 116 | |
| 117 | def test_to_string(): |
| 118 | s = SchemaSerializer(core_schema.any_schema(serialization={'type': 'to-string'})) |
| 119 | assert s.to_python(123, mode='json') == '123' |
| 120 | assert s.to_python(None, mode='json') is None |
| 121 | uuid = UUID('ebcdab58-6eb8-46fb-a190-d07a33e9eac8') |
| 122 | assert s.to_python(uuid, mode='json') == str(uuid) |
| 123 | assert s.to_json(uuid) == b'"%s"' % str(uuid).encode('utf-8') |
| 124 | with pytest.raises(ValueError, match='broken'): |
| 125 | s.to_python(BrokenToString(), mode='json') |
nothing calls this directly
no test coverage detected