Skip to content

Commit 7faaee3

Browse files
committed
test skiprows
1 parent a9a3386 commit 7faaee3

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

neo/test/iotest/test_asciisignalio.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,29 @@ def reader(filename, comment_rows):
133133

134134
os.remove(filename)
135135

136+
def test_skiprows(self):
137+
filename = 'test_skiprows.txt'
138+
sample_data = [
139+
(-65, -65, -65, 0.5),
140+
(-64.8, -64.5, -64.0, 0.6),
141+
(-64.6, -64.2, -77.0, 0.7),
142+
(-64.3, -64.0, -99.9, 0.8),
143+
(-66, -64.3, -61.0, 1.4),
144+
]
145+
with open(filename, 'w') as datafile:
146+
for row in sample_data:
147+
datafile.write("\t ".join(map(str, row)) + "\t\n")
148+
io = AsciiSignalIO(filename, skiprows=1)
149+
block = io.read_block()
150+
signal = block.segments[0].analogsignals[0]
151+
self.assertEqual(signal.shape, (4, 1))
152+
self.assertEqual(len(block.segments[0].analogsignals), 5)
153+
self.assertEqual(len(block.segments[0].analogsignals[0]), 4)
154+
self.assertEqual(signal.units, pq.V)
155+
156+
os.remove(filename)
157+
136158
# test usecols
137-
# test skiprows
138159

139160
def test_timecolumn(self):
140161
sample_data = np.random.uniform(size=(200, 3))

0 commit comments

Comments
 (0)