Skip to content

Commit

Permalink
add iterative write check for timestamps (#1012)
Browse files Browse the repository at this point in the history
* add iterative write check for timestamps
  • Loading branch information
bendichter authored and oruebel committed Jul 30, 2019
1 parent 9da1493 commit 78036c4
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/integration/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,26 @@ def test_write_dataset_custom_fillvalue(self):
self.assertTrue(np.all(dset[:] == a.data))
self.assertEqual(dset.fillvalue, -1)

def test_write_dataset_datachunkiterator(self):
def test_write_dataset_datachunkiterator_data_and_time(self):
a = np.arange(30).reshape(5, 2, 3)
aiter = iter(a)
daiter = DataChunkIterator.from_iterable(aiter, buffer_size=2)
ts = TimeSeries('ts_name', daiter, 'A', timestamps=np.arange(5))
tstamps = np.arange(5)
tsiter = DataChunkIterator.from_iterable(tstamps)
ts = TimeSeries('ts_name', daiter, 'A', timestamps=tsiter)
self.nwbfile.add_acquisition(ts)
with NWBHDF5IO(self.path, 'w') as io:
io.write(self.nwbfile, cache_spec=False)
with File(self.path, 'r') as f:
dset = f['/acquisition/ts_name/data']
self.assertListEqual(dset[:].tolist(), a.tolist())

def test_write_dataset_datachunkiterator_data_only(self):
a = np.arange(30).reshape(5, 2, 3)
aiter = iter(a)
daiter = DataChunkIterator.from_iterable(aiter, buffer_size=2)
tstamps = np.arange(5)
ts = TimeSeries('ts_name', daiter, 'A', timestamps=tstamps)
self.nwbfile.add_acquisition(ts)
with NWBHDF5IO(self.path, 'w') as io:
io.write(self.nwbfile, cache_spec=False)
Expand Down

0 comments on commit 78036c4

Please sign in to comment.