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

test: update tests asserts #116

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
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
21 changes: 14 additions & 7 deletions tests/convert/ledger/eip712/test_convert_eip712_round_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,20 @@ def _cleanup_formats(formats: dict[str, Any]) -> Any:
del_by_path(message, "screens")
if "fields" in message:
for field in message["fields"]:
# Other formats are always converted to RAW
if "format" in field and field["format"] not in (
FieldFormat.AMOUNT,
FieldFormat.TOKEN_AMOUNT,
FieldFormat.DATE,
):
field["format"] = "raw"
if "format" in field:
format = field["format"]

# Address name format parameters cannot be preserved
if format == "addressName":
del_by_path(field, "params")

# Other formats are always converted to RAW
if format not in (
FieldFormat.AMOUNT,
FieldFormat.TOKEN_AMOUNT,
FieldFormat.DATE,
):
field["format"] = "raw"

return formats

Expand Down
30 changes: 0 additions & 30 deletions tests/convert/resolved/data/format_address_name_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,36 +42,6 @@
"formats": {
"TestPrimaryType": {
"fields": [
{
"path": "param1",
"label": "Minimal parameters set",
"format": "addressName"
},
{
"path": "param1",
"label": "types specified",
"format": "addressName",
"params": {
"types": [
"wallet",
"eoa",
"token",
"contract",
"collection"
]
}
},
{
"path": "param1",
"label": "sources specified",
"format": "addressName",
"params": {
"sources": [
"local",
"ens"
]
}
},
{
"path": "param1",
"label": "All parameters specified",
Expand Down
57 changes: 0 additions & 57 deletions tests/convert/resolved/data/format_address_name_resolved.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,63 +43,6 @@
"formats": {
"TestPrimaryType": {
"fields": [
{
"path": {
"type": "data",
"absolute": true,
"elements": [
{
"type": "field",
"identifier": "param1"
}
]
},
"label": "Minimal parameters set",
"format": "addressName"
},
{
"path": {
"type": "data",
"absolute": true,
"elements": [
{
"type": "field",
"identifier": "param1"
}
]
},
"label": "types specified",
"format": "addressName",
"params": {
"types": [
"wallet",
"eoa",
"token",
"contract",
"collection"
]
}
},
{
"path": {
"type": "data",
"absolute": true,
"elements": [
{
"type": "field",
"identifier": "param1"
}
]
},
"label": "sources specified",
"format": "addressName",
"params": {
"sources": [
"local",
"ens"
]
}
},
{
"path": {
"type": "data",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@
"metadata": {
"constants": {
"path": "#.param1",
"label1": "Minimal parameters set",
"label2": "types specified",
"label3": "sources specified",
"label4": "All parameters specified"
"label": "All parameters specified"
}
},
"display": {
Expand All @@ -52,37 +49,7 @@
"fields": [
{
"path": "$.metadata.constants.path",
"label": "$.metadata.constants.label1",
"format": "addressName"
},
{
"path": "$.metadata.constants.path",
"label": "$.metadata.constants.label2",
"format": "addressName",
"params": {
"types": [
"wallet",
"eoa",
"token",
"contract",
"collection"
]
}
},
{
"path": "$.metadata.constants.path",
"label": "$.metadata.constants.label3",
"format": "addressName",
"params": {
"sources": [
"local",
"ens"
]
}
},
{
"path": "$.metadata.constants.path",
"label": "$.metadata.constants.label4",
"label": "$.metadata.constants.label",
"format": "addressName",
"params": {
"types": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,63 +43,6 @@
"formats": {
"TestPrimaryType": {
"fields": [
{
"path": {
"type": "data",
"absolute": true,
"elements": [
{
"type": "field",
"identifier": "param1"
}
]
},
"label": "Minimal parameters set",
"format": "addressName"
},
{
"path": {
"type": "data",
"absolute": true,
"elements": [
{
"type": "field",
"identifier": "param1"
}
]
},
"label": "types specified",
"format": "addressName",
"params": {
"types": [
"wallet",
"eoa",
"token",
"contract",
"collection"
]
}
},
{
"path": {
"type": "data",
"absolute": true,
"elements": [
{
"type": "field",
"identifier": "param1"
}
]
},
"label": "sources specified",
"format": "addressName",
"params": {
"sources": [
"local",
"ens"
]
}
},
{
"path": {
"type": "data",
Expand Down
Loading