Skip to content

Commit 671c008

Browse files
author
Cody Baker
committed
Merge branch 'fix_test_for_2_1_0' into debug_none_names
2 parents 279ae7d + 6ff7173 commit 671c008

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pynwb>=1.4.0,<2.1.0 # TODO, debug 2.1.0?
1+
pynwb
22
PyYAML
33
jsonschema
44
packaging

tests/unit_tests/test_tables.py

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import platform
22
import json
33
from unittest import TestCase
4+
from packaging import version
45

56
import numpy as np
67
from hdmf.common import DynamicTable, DynamicTableRegion
@@ -17,6 +18,7 @@
1718
check_single_row,
1819
check_table_values_for_dict,
1920
)
21+
from nwbinspector.utils import get_package_version
2022

2123

2224
class TestCheckDynamicTableRegion(TestCase):
@@ -227,26 +229,37 @@ def test_check_single_row_pass():
227229

228230
def test_check_single_row_ignore_units():
229231
table = Units(
230-
name="Units", # default name when building through nwbfile
231-
)
232+
name="Units",
233+
) # default name when building through nwbfile
232234
table.add_unit(spike_times=[1, 2, 3])
233235
assert check_single_row(table=table) is None
234236

235237

236238
def test_check_single_row_ignore_electrodes():
237239
table = ElectrodeTable(
238-
name="electrodes", # default name when building through nwbfile
239-
)
240-
table.add_row(
241-
x=np.nan,
242-
y=np.nan,
243-
z=np.nan,
244-
imp=np.nan,
245-
location="unknown",
246-
filtering="unknown",
247-
group=ElectrodeGroup(name="test_group", description="", device=Device(name="test_device"), location="unknown"),
248-
group_name="test_group",
249-
)
240+
name="electrodes",
241+
) # default name when building through nwbfile
242+
if get_package_version(name="pynwb") >= version.Version("2.1.0"):
243+
table.add_row(
244+
location="unknown",
245+
group=ElectrodeGroup(
246+
name="test_group", description="", device=Device(name="test_device"), location="unknown"
247+
),
248+
group_name="test_group",
249+
)
250+
else:
251+
table.add_row(
252+
x=np.nan,
253+
y=np.nan,
254+
z=np.nan,
255+
imp=np.nan,
256+
location="unknown",
257+
filtering="unknown",
258+
group=ElectrodeGroup(
259+
name="test_group", description="", device=Device(name="test_device"), location="unknown"
260+
),
261+
group_name="test_group",
262+
)
250263
assert check_single_row(table=table) is None
251264

252265

0 commit comments

Comments
 (0)