MCPcopy
hub / github.com/pydantic/pydantic / test_date_key

Function test_date_key

pydantic-core/tests/serializers/test_datetime.py:75–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73
74
75def test_date_key():
76 v = SchemaSerializer(core_schema.dict_schema(core_schema.date_schema(), core_schema.date_schema()))
77 assert v.to_python({date(2022, 12, 2): date(2022, 12, 2)}) == {date(2022, 12, 2): date(2022, 12, 2)}
78 assert v.to_python({date(2022, 12, 2): date(2022, 12, 2)}, mode='json') == {'2022-12-02': '2022-12-02'}
79 assert v.to_json({date(2022, 12, 2): date(2022, 12, 2)}) == b'{"2022-12-02":"2022-12-02"}'
80
81
82def test_time():

Callers

nothing calls this directly

Calls 2

dict_schemaMethod · 0.80
date_schemaMethod · 0.80

Tested by

no test coverage detected