diff --git a/tests/src/erc7730/common/test_datamodel.py b/tests/src/erc7730/common/test_datamodel.py index 33e32ee..1036dd5 100644 --- a/tests/src/erc7730/common/test_datamodel.py +++ b/tests/src/erc7730/common/test_datamodel.py @@ -3,6 +3,7 @@ from erc7730.common.pydantic import json_file_from_model from erc7730.model.context import AbiJsonSchemaItem from erc7730.model.erc7730_descriptor import ERC7730Descriptor +from erc7730.model.display import Display import pytest import glob import json @@ -38,3 +39,14 @@ def test_23_unset_attributes_must_not_be_serialized_as_set() -> None: abi_item_json_str_deserialized = json_file_from_model(AbiJsonSchemaItem, abi_item) print_diff(abi_item_json_str, abi_item_json_str_deserialized) assert abi_item_json_str == abi_item_json_str_deserialized + + +display_json_str = '{"formats":{"Permit":{"screens":{"stax":[{"type":"propertyPage","label":"DAI Permit","content":["spender","value","deadline"]}]}}}}' + + +def test_22_screens_serialization_not_symmetric() -> None: + display_json = json.loads(display_json_str) + display = Display.model_validate(display_json, strict=False) + display_json_deserialized = json_file_from_model(Display, display) + print_diff(display_json_str, display_json_deserialized) + assert display_json_str == display_json_deserialized