Skip to content

Commit 2a9cfc2

Browse files
author
kleinjohann
committed
Add tests for multiple columns and negative floats
1 parent 3d62be0 commit 2a9cfc2

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

neo/test/rawiotest/test_phyrawio.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,35 @@ def test_csv_tsv_parser_with_csv(self):
3131
csv_tempfile = Path(tempfile.gettempdir()).joinpath('test.csv')
3232
with open(csv_tempfile, 'w') as csv_file:
3333
csv_writer = csv.writer(csv_file, delimiter=',')
34-
csv_writer.writerow(['cluster_id', 'some_annotation'])
35-
csv_writer.writerow([1, 'Good'])
36-
csv_writer.writerow([2, 10])
37-
csv_writer.writerow([3, 1.23])
34+
csv_writer.writerow(['cluster_id', 'some_annotation', 'some_other_annotation'])
35+
csv_writer.writerow([1, 'Good', 'Bad'])
36+
csv_writer.writerow([2, 10, -2])
37+
csv_writer.writerow([3, 1.23, -0.38])
3838

3939
# the parser in PhyRawIO runs csv.DictReader to parse the file
4040
# csv.DictReader for python version 3.6+ returns list of OrderedDict
4141
if (3, 6) <= sys.version_info < (3, 8):
4242
target = [OrderedDict({'cluster_id': 1,
43-
'some_annotation': 'Good'}),
43+
'some_annotation': 'Good',
44+
'some_other_annotation': 'Bad'}),
4445
OrderedDict({'cluster_id': 2,
45-
'some_annotation': 10}),
46+
'some_annotation': 10,
47+
'some_other_annotation': -2}),
4648
OrderedDict({'cluster_id': 3,
47-
'some_annotation': 1.23})]
49+
'some_annotation': 1.23,
50+
'some_other_annotation': -0.38})]
4851

4952
# csv.DictReader for python version 3.8+ returns list of dict
5053
elif sys.version_info >= (3, 8):
51-
target = [{'cluster_id': 1, 'some_annotation': 'Good'},
52-
{'cluster_id': 2, 'some_annotation': 10},
53-
{'cluster_id': 3, 'some_annotation': 1.23}]
54+
target = [{'cluster_id': 1,
55+
'some_annotation': 'Good',
56+
'some_other_annotation': 'Bad'},
57+
{'cluster_id': 2,
58+
'some_annotation': 10,
59+
'some_other_annotation': -2},
60+
{'cluster_id': 3,
61+
'some_annotation': 1.23,
62+
'some_other_annotation': -0.38}]
5463

5564
list_of_dict = PhyRawIO._parse_tsv_or_csv_to_list_of_dict(csv_tempfile)
5665

0 commit comments

Comments
 (0)