Skip to content

Commit

Permalink
Screens serialization not symmetric #22
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaireGuerreGiordano committed Sep 25, 2024
1 parent a43f4f5 commit 7e01591
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/src/erc7730/common/test_datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 7e01591

Please sign in to comment.