|
16 | 16 | check_regular_timestamps, |
17 | 17 | check_data_orientation, |
18 | 18 | check_timestamps_match_first_dimension, |
| 19 | + check_session_start_time_old_date, |
| 20 | + check_description, |
| 21 | + available_checks, |
19 | 22 | ) |
20 | | -from nwbinspector.nwbinspector import inspect_all, inspect_nwb, configure_checks |
| 23 | +from nwbinspector.nwbinspector import inspect_all, inspect_nwb |
21 | 24 | from nwbinspector.register_checks import Severity, InspectorMessage, register_check |
22 | 25 | from nwbinspector.utils import FilePathType |
23 | 26 | from nwbinspector.tools import make_minimal_nwbfile |
@@ -436,3 +439,54 @@ def test_inspect_nwb_manual_iteration_stop(self): |
436 | 439 | generator = inspect_nwb(nwbfile_path=self.nwbfile_paths[2], checks=self.checks) |
437 | 440 | with self.assertRaises(expected_exception=StopIteration): |
438 | 441 | next(generator) |
| 442 | + |
| 443 | + |
| 444 | +class TestSessionStartTimesOnFile(TestCase): |
| 445 | + @classmethod |
| 446 | + def setUpClass(cls): |
| 447 | + cls.tempdir = Path(mkdtemp()) |
| 448 | + cls.nwbfile_path = cls.tempdir / "test.nwb" |
| 449 | + nwbfile = make_minimal_nwbfile() |
| 450 | + nwbfile.add_acquisition(DynamicTable(name="test", description="")) |
| 451 | + with NWBHDF5IO(path=cls.nwbfile_path, mode="w") as io: |
| 452 | + io.write(nwbfile) |
| 453 | + |
| 454 | + @classmethod |
| 455 | + def tearDownClass(cls): |
| 456 | + rmtree(cls.tempdir) |
| 457 | + |
| 458 | + def test_check_session_start_time_old_date_through_inspect_nwb(self): |
| 459 | + results = list( |
| 460 | + inspect_nwb( |
| 461 | + # nwbfile_path=self.nwbfile_path, |
| 462 | + nwbfile_path=self.nwbfile_path, |
| 463 | + checks=[check_session_start_time_old_date], |
| 464 | + ) |
| 465 | + ) |
| 466 | + results_errors = [x for x in results if x.importance.name == "ERROR"] |
| 467 | + assert results_errors == [] |
| 468 | + |
| 469 | + def test_check_session_start_time_old_date_through_inspect_nwb_before_description_check(self): |
| 470 | + results = list( |
| 471 | + inspect_nwb( |
| 472 | + nwbfile_path=self.nwbfile_path, |
| 473 | + checks=[check_session_start_time_old_date, check_description], |
| 474 | + ) |
| 475 | + ) |
| 476 | + results_errors = [x for x in results if x.importance.name == "ERROR"] |
| 477 | + assert results_errors == [] |
| 478 | + |
| 479 | + def test_check_session_start_time_old_date_through_inspect_nwb_with_description_check(self): |
| 480 | + results = list( |
| 481 | + inspect_nwb( |
| 482 | + # nwbfile_path=self.nwbfile_path, |
| 483 | + nwbfile_path=self.nwbfile_path, |
| 484 | + checks=[check_description, check_session_start_time_old_date], |
| 485 | + ) |
| 486 | + ) |
| 487 | + results_errors = [x for x in results if x.importance.name == "ERROR"] |
| 488 | + # print(results_errors) |
| 489 | + # if results_errors: |
| 490 | + # print(results_errors[0].message) |
| 491 | + # assert results_errors == [] |
| 492 | + assert len(results_errors) != 0 |
0 commit comments