Skip to content

Commit

Permalink
move the test to the indicated place
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin committed Dec 12, 2023
1 parent e8c4e3d commit 0c07566
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions tests/integration/hdf5/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,19 @@ def test_write_no_cache_spec(self):
io.write(self.container, cache_spec=False)
with File(self.path, 'r') as f:
self.assertNotIn('specifications', f)

def test_file_creation_io_modes(self):
io_modes_that_create_file = ["w", "w-", "x"]

with tempfile.TemporaryDirectory() as temp_dir:
temp_dir = Path(temp_dir)
for io_mode in io_modes_that_create_file:
file_path = temp_dir / f"test_io_mode={io_mode}.nwb"

# Test file creation
nwbfile = mock_NWBFile()
with NWBHDF5IO(str(file_path), io_mode) as io:
io.write(nwbfile)


class TestHDF5WriterWithInjectedFile(TestCase):
Expand Down Expand Up @@ -519,17 +532,3 @@ def test_round_trip_with_pathlib_path(self):
read_file = io.read()
self.assertContainerEqual(read_file, self.nwbfile)


class TestNWBHDF5IOModes(TestCase):
def test_file_creation_and_deletion(self):
io_modes_that_create_file = ["w", "w-", "x"]

with tempfile.TemporaryDirectory() as temp_dir:
temp_dir = Path(temp_dir)
for io_mode in io_modes_that_create_file:
file_path = temp_dir / f"test_io_mode={io_mode}.nwb"

# Test file creation
nwbfile = mock_NWBFile()
with NWBHDF5IO(str(file_path), io_mode) as io:
io.write(nwbfile)

0 comments on commit 0c07566

Please sign in to comment.