@@ -114,30 +114,18 @@ def mock_bids_validate(*args: Any, **kwargs: Any) -> list[ValidationResult]:
114114 assert err .dataset_path is not None
115115 assert err .path .relative_to (err .dataset_path ).as_posix () == dandiset_metadata_file
116116
117- # The error message should be the original BIDS error, not modified
118- assert err .message is not None
119- # We just check that it's about dandiset.yaml, not checking exact message
120- # since it comes from BIDS validator
121-
122- # Check that there is also a HINT about .bidsignore
123- validation_hints = [
124- r
125- for r in validation_results
126- if r .severity is not None and r .severity == Severity .HINT
127- ]
128-
129- # Assert that there is at least one hint
130- assert len (validation_hints ) >= 1
131-
132- # Find the hint about .bidsignore for dandiset.yaml
133- bidsignore_hint = next (
134- (h for h in validation_hints if h .id == "DANDI.BIDSIGNORE_DANDISET_YAML" ),
135- None ,
136- )
137- assert bidsignore_hint is not None
138- assert bidsignore_hint .message is not None
139- assert ".bidsignore" in bidsignore_hint .message
140- assert dandiset_metadata_file in bidsignore_hint .message
117+ # === Assert that there is the dandiset.yaml hint ===
118+ i = None
119+ for i , r in enumerate (validation_results ):
120+ if r is err :
121+ break
122+
123+ assert i is not None
124+ # There must be at least one more result after the error
125+ assert len (validation_results ) > i + 1
126+ # The next result must be the hint re: dandiset.yaml
127+ assert validation_results [i + 1 ].id == "DANDI.BIDSIGNORE_DANDISET_YAML"
128+ assert validation_results [i + 1 ].severity == Severity .HINT
141129
142130
143131def test_validate_bids_onefile (bids_error_examples : Path , tmp_path : Path ) -> None :
0 commit comments