Skip to content

Commit

Permalink
fix test class names; add more zarr
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD committed Sep 17, 2024
1 parent a28c8d7 commit 9563e7c
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions tests/test_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from hdmf.backends.io import HDMFIO
from hdmf.common import DynamicTable
from natsort import natsorted
from pynwb import NWBHDF5IO, NWBFile, TimeSeries
from pynwb import NWBFile, TimeSeries
from pynwb.behavior import Position, SpatialSeries
from pynwb.file import Subject, TimeIntervals

Expand Down Expand Up @@ -594,7 +594,8 @@ class TestInspectorAPIHZarr(TestInspectorAPIHDF5):
BackendIOClass = BACKEND_IO_CLASSES["zarr"]


class TestDANDIConfig(TestInspector):
class TestDANDIConfigHDF5(TestInspectorOnBackend):
BackendIOClass = BACKEND_IO_CLASSES["hdf5"]
maxDiff = None

@classmethod
Expand All @@ -612,9 +613,10 @@ def setUpClass(cls):
add_simple_table(nwbfiles[0])
add_flipped_data_orientation_to_acquisition(nwbfiles[1])

cls.nwbfile_paths = [str(cls.tempdir / f"testing{j}.nwb") for j in range(num_nwbfiles)]
suffix = IO_CLASSES_TO_BACKEND[cls.BackendIOClass]
cls.nwbfile_paths = [str(cls.tempdir / f"testing{j}.nwb.{suffix}") for j in range(num_nwbfiles)]
for nwbfile_path, nwbfile in zip(cls.nwbfile_paths, nwbfiles):
with NWBHDF5IO(path=nwbfile_path, mode="w") as io:
with cls.BackendIOClass(path=nwbfile_path, mode="w") as io:
io.write(nwbfile)

@classmethod
Expand Down Expand Up @@ -702,7 +704,12 @@ def test_inspect_nwbfile_dandi_config_critical_only_entire_registry_cli(self):
)


class TestCheckUniqueIdentifiersPass(TestCase):
class TestDANDIConfigZarr(TestInspectorOnBackend):
BackendIOClass = BACKEND_IO_CLASSES["zarr"]


class TestCheckUniqueIdentifiersPassHDF5(TestCase):
BackendIOClass = BACKEND_IO_CLASSES["hdf5"]
maxDiff = None

@classmethod
Expand All @@ -713,9 +720,12 @@ def setUpClass(cls):
for j in range(num_nwbfiles):
unique_id_nwbfiles.append(make_minimal_nwbfile())

cls.unique_id_nwbfile_paths = [str(cls.tempdir / f"unique_id_testing{j}.nwb") for j in range(num_nwbfiles)]
suffix = IO_CLASSES_TO_BACKEND[cls.BackendIOClass]
cls.unique_id_nwbfile_paths = [
str(cls.tempdir / f"unique_id_testing{j}.nwb.{suffix}") for j in range(num_nwbfiles)
]
for nwbfile_path, nwbfile in zip(cls.unique_id_nwbfile_paths, unique_id_nwbfiles):
with NWBHDF5IO(path=nwbfile_path, mode="w") as io:
with BackendIOClass(path=nwbfile_path, mode="w") as io:
io.write(nwbfile)

@classmethod
Expand All @@ -726,7 +736,12 @@ def test_check_unique_identifiers_pass(self):
assert list(inspect_all(path=self.tempdir, select=["check_data_orientation"])) == []


class TestCheckUniqueIdentifiersFail(TestCase):
class TestCheckUniqueIdentifiersPassZarr(TestCase):
BackendIOClass = BACKEND_IO_CLASSES["zarr"]


class TestCheckUniqueIdentifiersFailHDF5(TestCase):
BackendIOClass = BACKEND_IO_CLASSES["zarr"]
maxDiff = None

@classmethod
Expand All @@ -743,11 +758,12 @@ def setUpClass(cls):
)
)

suffix = IO_CLASSES_TO_BACKEND[cls.BackendIOClass]
cls.non_unique_id_nwbfile_paths = [
str(cls.tempdir / f"non_unique_id_testing{j}.nwb") for j in range(num_nwbfiles)
str(cls.tempdir / f"non_unique_id_testing{j}.nwb.{suffix}") for j in range(num_nwbfiles)
]
for nwbfile_path, nwbfile in zip(cls.non_unique_id_nwbfile_paths, non_unique_id_nwbfiles):
with NWBHDF5IO(path=nwbfile_path, mode="w") as io:
with BackendIOClass(path=nwbfile_path, mode="w") as io:
io.write(nwbfile)

@classmethod
Expand Down

0 comments on commit 9563e7c

Please sign in to comment.