diff --git a/hed/tools/bids/bids_dataset.py b/hed/tools/bids/bids_dataset.py index 0438cb5fe..bbb06ae7b 100644 --- a/hed/tools/bids/bids_dataset.py +++ b/hed/tools/bids/bids_dataset.py @@ -79,18 +79,14 @@ def validate(self, types=None, check_for_warnings=True): list: List of issues encountered during validation. Each issue is a dictionary. """ - validator = HedValidator(hed_schema=self.schema) - error_handler = ErrorHandler() + if not types: types = list(self.tabular_files.keys()) issues = [] for tab_type in types: files = self.tabular_files[tab_type] - issues += files.validate_sidecars(self.schema, - check_for_warnings=check_for_warnings, error_handler=error_handler) - issues += files.validate_datafiles(self.schema, - check_for_warnings=check_for_warnings, - error_handler=error_handler) + issues += files.validate_sidecars(self.schema, check_for_warnings=check_for_warnings) + issues += files.validate_datafiles(self.schema, check_for_warnings=check_for_warnings) return issues def get_summary(self): diff --git a/hed/tools/bids/bids_file_group.py b/hed/tools/bids/bids_file_group.py index dfb3439af..44f3f1a21 100644 --- a/hed/tools/bids/bids_file_group.py +++ b/hed/tools/bids/bids_file_group.py @@ -132,7 +132,8 @@ def validate_sidecars(self, hed_schema, extra_def_dicts=None, check_for_warnings for sidecar in self.sidecar_dict.values(): name = os.path.basename(sidecar.file_path) - issues += validator.validate(extra_def_dicts=extra_def_dicts, name=name, error_handler=error_handler) + issues += validator.validate(sidecar.contents, extra_def_dicts=extra_def_dicts, name=name, + error_handler=error_handler) return issues def validate_datafiles(self, hed_schema, extra_def_dicts=None, check_for_warnings=True, keep_contents=False): @@ -154,7 +155,7 @@ def validate_datafiles(self, hed_schema, extra_def_dicts=None, check_for_warning for data_obj in self.datafile_dict.values(): data_obj.set_contents(overwrite=False) name = os.path.basename(data_obj.file_path) - issues += data_obj.contents.validate(data_obj.contents, extra_def_dicts=None, name=name, + issues += data_obj.contents.validate(hed_schema, extra_def_dicts=None, name=name, error_handler=error_handler) if not keep_contents: data_obj.clear_contents() diff --git a/tests/tools/analysis/test_event_manager.py b/tests/tools/analysis/test_event_manager.py index 09eb17a50..8f84549d1 100644 --- a/tests/tools/analysis/test_event_manager.py +++ b/tests/tools/analysis/test_event_manager.py @@ -36,7 +36,6 @@ def test_constructor(self): self.assertEqual(event.start_time, manager1.data.dataframe.loc[index, "onset"]) if not event.end_time: self.assertEqual(event.end_index, len(manager1.data.dataframe)) - print("to here") # def test_constructor(self): # with self.assertRaises(ValueError) as cont: diff --git a/tests/tools/bids/test_bids_dataset.py b/tests/tools/bids/test_bids_dataset.py index df02448bf..6289be314 100644 --- a/tests/tools/bids/test_bids_dataset.py +++ b/tests/tools/bids/test_bids_dataset.py @@ -68,21 +68,18 @@ def test_validator(self): self.assertTrue(issues, "BidsDataset validate should return issues when the default check_for_warnings is used") issues = bids.validate(check_for_warnings=True) self.assertTrue(issues, "BidsDataset validate should return issues when check_for_warnings is True") - # ToDO - # issues = bids.validate(check_for_warnings=False) - # self.assertFalse(issues, "BidsDataset validate should return no issues when check_for_warnings is False") + issues = bids.validate(check_for_warnings=False) + self.assertFalse(issues, "BidsDataset validate should return no issues when check_for_warnings is False") def test_validator_libraries(self): bids = BidsDataset(self.library_path) - # ToDO check_for_warnings - # issues = bids.validate(check_for_warnings=False) - # self.assertFalse(issues, "BidsDataset with libraries should validate") + issues = bids.validate(check_for_warnings=False) + self.assertFalse(issues, "BidsDataset with libraries should validate") def test_validator_types(self): bids = BidsDataset(self.root_path, tabular_types=None) - # ToDO: check_for_warnings - # issues = bids.validate(check_for_warnings=False) - # self.assertFalse(issues, "BidsDataset with participants and events validates") + issues = bids.validate(check_for_warnings=False) + self.assertFalse(issues, "BidsDataset with participants and events validates") def test_with_schema_group(self): base_version = '8.0.0' diff --git a/tests/tools/remodeling/cli/test_run_remodel.py b/tests/tools/remodeling/cli/test_run_remodel.py index d0611058e..099f80252 100644 --- a/tests/tools/remodeling/cli/test_run_remodel.py +++ b/tests/tools/remodeling/cli/test_run_remodel.py @@ -97,9 +97,7 @@ def test_main_bids_no_sidecar_with_hed(self): os.remove(self.sidecar_path) with patch('sys.stdout', new=io.StringIO()) as fp: main(arg_list) - a = fp.getvalue() - print("to here") - #self.assertFalse(fp.getvalue()) + self.assertFalse(fp.getvalue()) def test_main_direct_no_sidecar(self): arg_list = [self.data_root, self.model_path, '-x', 'derivatives', 'stimuli']