MCPcopy
hub / github.com/pydantic/pydantic / test_uuid_key

Function test_uuid_key

pydantic-core/tests/serializers/test_uuid.py:30–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28
29
30def test_uuid_key():
31 v = SchemaSerializer(core_schema.dict_schema(core_schema.uuid_schema(), core_schema.uuid_schema()))
32 assert v.to_python(
33 {UUID('12345678-1234-5678-1234-567812345678'): UUID('12345678-1234-5678-1234-567812345678')}
34 ) == {UUID('12345678-1234-5678-1234-567812345678'): UUID('12345678-1234-5678-1234-567812345678')}
35 assert v.to_python(
36 {UUID('12345678-1234-5678-1234-567812345678'): UUID('12345678-1234-5678-1234-567812345678')}, mode='json'
37 ) == {'12345678-1234-5678-1234-567812345678': '12345678-1234-5678-1234-567812345678'}
38 assert (
39 v.to_json({UUID('12345678-1234-5678-1234-567812345678'): UUID('12345678-1234-5678-1234-567812345678')})
40 == b'{"12345678-1234-5678-1234-567812345678":"12345678-1234-5678-1234-567812345678"}'
41 )
42
43
44@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

dict_schemaMethod · 0.80
uuid_schemaMethod · 0.80

Tested by

no test coverage detected