Skip to content

Commit

Permalink
Refacto: refactoring test
Browse files Browse the repository at this point in the history
  • Loading branch information
amelie-rondot committed Feb 10, 2024
1 parent e7f50d2 commit f14c48b
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions tests/table/test_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def test_missing_primary_key_label_with_shema_sync_issue_1633():
"nb_errors": 1,
"types_errors_expected": ["missing-label"],
},
# { # This test case raise the unexpected KeyError we want to fix
# "constraints": {},
# "nb_errors": 1,
# "types_errors_expected": ["missing-label"],
# },
{
"constraints": {},
"nb_errors": 1,
"types_errors_expected": ["missing-label"],
},
]

for tc in test_cases:
Expand All @@ -75,24 +75,6 @@ def test_missing_primary_key_label_with_shema_sync_issue_1633():
for error, type_expected in zip(errors, tc["types_errors_expected"]):
assert error.type == type_expected

# TODO: fix this isolated test case and refactoring
schema_descriptor = {
"$schema": "https://frictionlessdata.io/schemas/table-schema.json",
"fields": [{"name": "A"}],
"primaryKey": ["A"],
}

resource = TableResource(
source=[["B"], ["foo"]],
schema=Schema.from_descriptor(schema_descriptor),
detector=frictionless.Detector(schema_sync=True),
)

report = frictionless.validate(resource)
errors = report.tasks[0].errors
assert len(errors) == 1
assert errors[0].type == "missing-label"

# # Ignore header_case
# schema_descriptor = {
# "$schema": "https://frictionlessdata.io/schemas/table-schema.json",
Expand Down

0 comments on commit f14c48b

Please sign in to comment.