Skip to content

Commit 0aa7e65

Browse files
committed
test skiprows
1 parent afde97a commit 0aa7e65

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

neo/test/iotest/test_asciisignalio.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from neo.test.iotest.common_io_test import BaseTestIO
1414
from neo.core import AnalogSignal, Segment, Block
1515

16+
import string
1617

1718
class TestAsciiSignalIOWithTestFiles(BaseTestIO, unittest.TestCase):
1819
ioclass = AsciiSignalIO
@@ -133,8 +134,27 @@ def reader(filename, comment_rows):
133134

134135
os.remove(filename)
135136

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

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

0 commit comments

Comments
 (0)