MCPcopy
hub / github.com/pydantic/pydantic / test_ipvany_serialization

Function test_ipvany_serialization

tests/test_networks_ipaddress.py:352–363  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

350
351
352def test_ipvany_serialization():
353 class Model(BaseModel):
354 address: IPvAnyAddress
355 network: IPvAnyNetwork
356 interface: IPvAnyInterface
357
358 m = Model(address='127.0.0.1', network='192.0.2.0/27', interface='127.0.0.1/32')
359 assert json.loads(m.model_dump_json()) == {
360 'address': '127.0.0.1',
361 'interface': '127.0.0.1/32',
362 'network': '192.0.2.0/27',
363 }
364
365
366@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

model_dump_jsonMethod · 0.80
ModelClass · 0.70

Tested by

no test coverage detected