From 6850d6e99f2587147833c661558a4f9a6a524cc8 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Wed, 14 Feb 2024 22:40:20 -0500 Subject: [PATCH] try to add test case to reproduce --- tests/test_inspector.py | 50 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/tests/test_inspector.py b/tests/test_inspector.py index 1c207f4db..9d599a1bf 100644 --- a/tests/test_inspector.py +++ b/tests/test_inspector.py @@ -589,7 +589,7 @@ def setUpClass(cls): @classmethod def tearDownClass(cls): rmtree(cls.tempdir) - + def test_inspect_nwbfile_dandi_config_critical_only_entire_registry(self): test_results = list( inspect_nwbfile( @@ -656,6 +656,54 @@ def test_inspect_nwbfile_dandi_config_violation_and_above_entire_registry(self): ] self.assertCountEqual(first=test_results, second=true_results) + def inspect_all_dandi_config_parallel(self): + + test_results = list(inspect_all(path=Path(self.nwbfile_paths[0]).parent, config=load_config(filepath_or_keyword="dandi"), n_jobs=2)) + + expected_results = [ + InspectorMessage( + message="Subject is missing.", + importance=Importance.CRITICAL, + check_function_name="check_subject_exists", + object_type="NWBFile", + object_name="root", + location="/", + file_path=self.nwbfile_paths[0], + ), + InspectorMessage( + message="The length of the first dimension of data (4) does not match the length of timestamps (3).", + importance=Importance.CRITICAL, + check_function_name="check_timestamps_match_first_dimension", + object_type="TimeSeries", + object_name="test_time_series_3", + location="/acquisition/test_time_series_3", + file_path=self.nwbfile_paths[0], + ), + InspectorMessage( + message="Subject is missing.", + importance=Importance.CRITICAL, + check_function_name="check_subject_exists", + object_type="NWBFile", + object_name="root", + location="/", + file_path=self.nwbfile_paths[1], + ), + InspectorMessage( + message=( + "Data may be in the wrong orientation. Time should be in the first dimension, " + "and is usually the longest dimension. Here, another dimension is longer." + ), + importance=Importance.BEST_PRACTICE_VIOLATION, + severity=Severity.LOW, + check_function_name="check_data_orientation", + object_type="TimeSeries", + object_name="my_spatial_series", + location="/acquisition/my_spatial_series", + file_path=self.nwbfile_paths[1], + ), + ] + self.assertCountEqual(first=test_results, second=true_results) + class TestCheckUniqueIdentifiersPass(TestCase): maxDiff = None