Skip to content

Commit

Permalink
Add a few more tests for the schema (#1963)
Browse files Browse the repository at this point in the history
- "explicit better than implicit" especially in case of tests
  • Loading branch information
yarikoptic authored Nov 1, 2024
1 parent dee65ee commit c2685cc
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tools/schemacode/bidsschematools/data/tests/test_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_rule_objects(schema_obj):
is_list = False

for i_use, use in enumerate(instance):
assert isinstance(use, str)
if use == "derivatives":
# Skip derivatives dirs, because the dir is treated as a "use" instead.
continue
Expand All @@ -81,9 +82,21 @@ def test_rule_objects(schema_obj):
object_values = [
value["value"] for value in schema_obj["objects"][object_type].values()
]
else:
elif object_type in [
"columns",
"common_principles",
"datatypes",
"entities",
"enums",
"files",
"formats",
"metadata",
"modalities",
]:
# But other object types are referenced via their keys
object_values = list(schema_obj["objects"][object_type].keys())
else:
raise AssertionError(f"Object type {object_type} not implemented.")

# Build a list of items mentioned in rules, but not found in objects.
if use not in object_values:
Expand Down

0 comments on commit c2685cc

Please sign in to comment.