diff --git a/tools/schemacode/bidsschematools/data/tests/test_rules.py b/tools/schemacode/bidsschematools/data/tests/test_rules.py index e8da90ee93..3eb11a6ed0 100644 --- a/tools/schemacode/bidsschematools/data/tests/test_rules.py +++ b/tools/schemacode/bidsschematools/data/tests/test_rules.py @@ -83,8 +83,7 @@ def test_rule_objects(schema_obj): if object_type in ["extensions", "suffixes"]: # Some object types are referenced via their "value" fields in the rules object_values = [ - schema_obj["objects"][object_type][k]["value"] - for k in schema_obj["objects"][object_type].keys() + value["value"] for value in schema_obj["objects"][object_type].values() ] else: # But other object types are referenced via their keys @@ -100,7 +99,7 @@ def test_rule_objects(schema_obj): if not_found: not_found_string = "\n".join([f"{'.'.join(path)} == {val}" for path, val in not_found]) - raise ValueError(not_found_string) + raise AssertionError(f"Undefined objects found in rules: {not_found_string}") @pytest.mark.validate_schema