From 7da754b218839489697d9dd6a7e56b919e1dffb7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 22:45:58 +0100 Subject: [PATCH 1/5] [pre-commit.ci] pre-commit autoupdate (#1729) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 24.2.0 → 24.3.0](https://github.com/psf/black/compare/24.2.0...24.3.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 82df6a67ae..baab783400 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: - id: check-added-large-files - id: check-case-conflict - repo: https://github.com/psf/black - rev: 24.2.0 + rev: 24.3.0 hooks: - id: black files: ^tools/(?!schemacode) From 5b4a840f74f64c32b9d82b3226a253a735f685a2 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 20 Mar 2024 11:44:33 -0400 Subject: [PATCH 2/5] REL: schema-0.8.0 --- src/schema/SCHEMA_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema/SCHEMA_VERSION b/src/schema/SCHEMA_VERSION index c4181d00bb..a3df0a6959 100644 --- a/src/schema/SCHEMA_VERSION +++ b/src/schema/SCHEMA_VERSION @@ -1 +1 @@ -0.7.3-dev +0.8.0 From 8628630770685413e525587de6835c6b17e74f17 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 20 Mar 2024 14:24:26 -0400 Subject: [PATCH 3/5] MNT: Schema version 0.8.1-dev --- src/schema/SCHEMA_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema/SCHEMA_VERSION b/src/schema/SCHEMA_VERSION index a3df0a6959..d182dc9160 100644 --- a/src/schema/SCHEMA_VERSION +++ b/src/schema/SCHEMA_VERSION @@ -1 +1 @@ -0.8.0 +0.8.1-dev From 9ed04a6a9a5fc4a04c28c7eebf0f850c1064c848 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 20 Mar 2024 14:25:25 -0400 Subject: [PATCH 4/5] [SCHEMA] Very minor tune ups to the test_rule_objects test while trying to grasp its function (#1728) * RF: minor simplification of Python code If the point is to go through values, just go through .values() without iterating through keys() and then dereferencing via [key] * Raise AssertionError in the test, not ValueError Since then also it is not clear if that is indeed some ValueError from within code. I also added a string which summarizes the problem. * Update tools/schemacode/bidsschematools/data/tests/test_rules.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Chris Markiewicz Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- tools/schemacode/bidsschematools/data/tests/test_rules.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 From 6d13c807c7c8d594a35d302d9aa6cff7c802f054 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 20 Mar 2024 14:26:44 -0400 Subject: [PATCH 5/5] Remove stale test comment -- test no longer fails! (#1727) --- tools/schemacode/bidsschematools/data/tests/test_rules.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/schemacode/bidsschematools/data/tests/test_rules.py b/tools/schemacode/bidsschematools/data/tests/test_rules.py index 3eb11a6ed0..6c46a5da5d 100644 --- a/tools/schemacode/bidsschematools/data/tests/test_rules.py +++ b/tools/schemacode/bidsschematools/data/tests/test_rules.py @@ -29,12 +29,8 @@ def _dict_key_lookup(_dict, key, path=[]): @pytest.mark.validate_schema def test_rule_objects(schema_obj): """Ensure that all objects referenced in the schema rules are defined in - its object portion. + their object portion. - This test currently fails because rules files reference object keys for some object types, - including entities, columns, and metadata fields, - but reference "name" or "value" elements of the object definitions for other object types, - including suffixes and extensions. In the case of datatypes, the key and "value" field are always the same. Some other object types, such as associated_data, common_principles, formats, modalities,