Skip to content

Commit 141fc3d

Browse files
committed
Add test with empty array annotation
1 parent 9db5911 commit 141fc3d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

neo/test/iotest/test_nixio.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,24 @@ def test_annotations_special_cases(self):
14861486

14871487
# TODO: multi dimensional value (GH Issue #501)
14881488

1489+
def test_empty_array_annotations(self):
1490+
wblock = Block("block with spiketrain")
1491+
wseg = Segment()
1492+
wseg.spiketrains = [SpikeTrain(times=[] * pq.s, t_stop=1 * pq.s,
1493+
array_annotations={'empty': []})]
1494+
wblock.segments = [wseg]
1495+
self.writer.write_block(wblock)
1496+
try:
1497+
rblock = self.writer.read_block(neoname="block with spiketrain")
1498+
except Exception as exc:
1499+
self.fail('The following exception was raised when'
1500+
+ ' reading the block with an empty array annotation:\n'
1501+
+ str(exc))
1502+
rst = rblock.segments[0].spiketrains[0]
1503+
self.assertEqual(len(rst.array_annotations), 1)
1504+
self.assertIn('empty', rst.array_annotations.keys())
1505+
self.assertEqual(len(rst.array_annotations['empty']), 0)
1506+
14891507
def test_write_proxyobjects(self):
14901508

14911509
def generate_complete_block():

0 commit comments

Comments
 (0)