Skip to content

Commit 9322346

Browse files
committed
Keep the custom schema duplicate test in one place
1 parent 1b67b25 commit 9322346

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

‎tests/test_lint_duplicates.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,5 @@ def test_custom_schema_skips_duplicate_checks(tmp_path):
123123
custom = tmp_path / "custom.json"
124124
custom.write_text('{"type":"object"}')
125125
assert lint(document(), schema_location=str(custom)).result == "passed"
126-
assert lint(document(schema=[{"name": "a"}, {"name": "a"}]), schema_location=str(custom)).result == "passed"
126+
schema = [{"name": "a", "id": "x"}, {"name": "a", "id": "x"}]
127+
assert lint(document(schema=schema), schema_location=str(custom)).result == "passed"

‎tests/test_lint_odcs_3_2_constraints.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,11 @@ def test_all_errors_combines_schema_and_enum_violations():
9191
assert any("duplicates enum" in reason for reason in reasons)
9292

9393

94-
@pytest.mark.parametrize("prop", [{"enum": [{"value": "a"}, {"value": "a"}]}, {"logicalType": "vector"}, {"id": "a"}])
94+
@pytest.mark.parametrize("prop", [{"enum": [{"value": "a"}, {"value": "a"}]}, {"logicalType": "vector"}])
9595
def test_custom_schema_remains_the_source_of_truth(tmp_path, prop):
9696
schema = tmp_path / "custom.json"
9797
schema.write_text('{"type":"object"}')
98-
doc = document(prop)
99-
doc["schema"][0]["properties"].append({"name": "field", **prop}) # duplicate name and id
100-
assert DataContract(data_contract_str=yaml.safe_dump(doc), schema_location=str(schema)).lint().result == "passed"
98+
assert lint(prop, schema_location=str(schema)).result == "passed"
10199

102100

103101
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)