Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screens serialization not symmetric #22 #30

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]}]}}}}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be a local variable in your test function



def test_22_screens_serialization_not_symmetric() -> None:
display_json = json.loads(display_json_str)
display = Display.model_validate(display_json, strict=True)
display_json_deserialized = json_file_from_model(Display, display)
print_diff(display_json_str, display_json_deserialized)
assert display_json_str == display_json_deserialized
Loading