From c2685ccc693fee58d3b03a24f5bd64bf3d1e4ff1 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 1 Nov 2024 15:07:23 -0400 Subject: [PATCH] Add a few more tests for the schema (#1963) - "explicit better than implicit" especially in case of tests --- .../bidsschematools/data/tests/test_rules.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/schemacode/bidsschematools/data/tests/test_rules.py b/tools/schemacode/bidsschematools/data/tests/test_rules.py index 39fce83a3a..f8e033379d 100644 --- a/tools/schemacode/bidsschematools/data/tests/test_rules.py +++ b/tools/schemacode/bidsschematools/data/tests/test_rules.py @@ -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 @@ -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: