Skip to content

Commit cd4f08f

Browse files
committed
fix pynwb table issue and try returning generator
1 parent d4733bf commit cd4f08f

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

nwbinspector/nwbinspector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ def _collect_all_messages(
493493
)
494494

495495
if driver != "ros3":
496-
yield _collect_all_messages(
496+
return _collect_all_messages(
497497
nwbfile_path=nwbfile_path, checks=checks, driver=driver, skip_validate=skip_validate
498498
)
499499
else:
@@ -502,7 +502,7 @@ def _collect_all_messages(
502502
while retries < max_retries:
503503
try:
504504
retries += 1
505-
yield _collect_all_messages(
505+
return _collect_all_messages(
506506
nwbfile_path=nwbfile_path, checks=checks, driver=driver, skip_validate=skip_validate
507507
)
508508
except OSError: # Cannot curl request

tests/unit_tests/test_tables.py

Lines changed: 23 additions & 10 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):
@@ -237,16 +239,27 @@ def test_check_single_row_ignore_electrodes():
237239
table = ElectrodeTable(
238240
name="electrodes", # default name when building through nwbfile
239241
)
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-
)
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)