Skip to content

Commit 5fe2c4f

Browse files
committed
test_XXX_nwb_data.py/test_nwb2_sink.py: Ignore DtypeConversionwarning
This ignores the following and similiar warnings: tests/dataset/test_mies_nwb_data.py: 2 warnings /home/thomas/.venvs/ipfx-3.9/lib/python3.9/site-packages/hdmf/build/objectmapper.py:267: DtypeConversionWarning: Spec 'CurrentClampSeries/sweep_number': Value with data type int64 is being converted to data type uint64 (min specification: uint32). warnings.warn(full_warning_msg, DtypeConversionWarning) tests/attach_metadata/test_nwb2_sink.py: 10 warnings tests/dataset/test_ephys_nwb_data.py: 6 warnings tests/dataset/test_hbg_nwb_data.py: 3 warnings tests/dataset/test_mies_nwb_data.py: 2 warnings /home/thomas/.venvs/ipfx-3.9/lib/python3.9/site-packages/hdmf/build/objectmapper.py:267: DtypeConversionWarning: Spec 'SweepTable/sweep_number': Value with data type int64 is being converted to data type uint64 (min specification: uint32). warnings.warn(full_warning_msg, DtypeConversionWarning) tests/dataset/test_ephys_nwb_data.py: 6 warnings tests/dataset/test_hbg_nwb_data.py: 3 warnings tests/dataset/test_mies_nwb_data.py: 2 warnings /home/thomas/.venvs/ipfx-3.9/lib/python3.9/site-packages/hdmf/build/objectmapper.py:267: DtypeConversionWarning: Spec 'CurrentClampStimulusSeries/sweep_number': Value with data type int64 is being converted to data type uint64 (min specification: uint32). warnings.warn(full_warning_msg, DtypeConversionWarning) Both int64 and uint64 are big enough for our number of sweeps. In addition this test is using existing files so even fixing/upgrading IPNWB would not solve the issue.
1 parent f9f4836 commit 5fe2c4f

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

tests/attach_metadata/test_nwb2_sink.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def test_get_subject(nwbfile, set_none):
7979
assert nwbfile.subject.subject_id == "foo"
8080

8181

82+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
8283
def test_serialize(tmpdir_factory, nwbfile):
8384
out_path = os.path.join(
8485
str(tmpdir_factory.mktemp("test_serialize")),
@@ -102,6 +103,7 @@ def test_serialize(tmpdir_factory, nwbfile):
102103
assert obt.identifier == "test session"
103104

104105

106+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
105107
def test_roundtrip(tmpdir_factory, nwbfile):
106108
tmpdir = str(tmpdir_factory.mktemp("test_serialize"))
107109
first_path = os.path.join(tmpdir, "first.nwb")
@@ -136,6 +138,7 @@ def test_roundtrip(tmpdir_factory, nwbfile):
136138
"Mus musculus"
137139
],
138140
])
141+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
139142
def test_register(
140143
tmpdir_factory, nwbfile, name, value, sweep_id, getter, expected
141144
):

tests/dataset/test_ephys_nwb_data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,17 @@ def nwb_data(tmp_nwb_path):
103103
return EphysNWBData(nwb_file=tmp_nwb_path, ontology=ontology)
104104

105105

106+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
106107
def test_get_stimulus_unit(nwb_data):
107108
assert nwb_data.get_stimulus_unit(sweep_number=4) == "Amps"
108109

109110

111+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
110112
def test_get_stimulus_code(nwb_data):
111113
assert nwb_data.get_stimulus_code(sweep_number=4) == "STIMULUS_CODE"
112114

113115

116+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
114117
def test_get_sweep_data(nwb_data):
115118

116119
expected = {
@@ -125,6 +128,7 @@ def test_get_sweep_data(nwb_data):
125128
assert list(diff(expected, obtained, tolerance=0.001)) == []
126129

127130

131+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
128132
def test_get_sweep_attrs(nwb_data):
129133

130134
expected = {
@@ -141,12 +145,14 @@ def test_get_sweep_attrs(nwb_data):
141145
print(expected)
142146
assert expected == obtained
143147

148+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
144149
def test_get_clamp_mode(nwb_data):
145150

146151
attrs = nwb_data.get_sweep_attrs(4);
147152

148153
assert attrs['clamp_mode'] == "CurrentClamp"
149154

155+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
150156
def test_get_full_recording_date(nwb_data):
151157
assert nwb_data.get_full_recording_date() == nwb_data.nwb.session_start_time
152158

tests/dataset/test_hbg_nwb_data.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ def hbg_nwb_data(tmp_nwb_path):
2727
return HBGNWBData(nwb_file=tmp_nwb_path, ontology=ontology)
2828

2929

30+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
3031
def test_create_hbg(hbg_nwb_data):
3132
assert isinstance(hbg_nwb_data,HBGNWBData)
3233

3334

35+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
3436
def test_get_sweep_metadata(hbg_nwb_data):
3537

3638
expected = {
@@ -48,6 +50,8 @@ def test_get_sweep_metadata(hbg_nwb_data):
4850
obtained = hbg_nwb_data.get_sweep_metadata(sweep_number=4)
4951
assert expected == obtained
5052

53+
54+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
5155
def test_get_stimulus_code_ext(hbg_nwb_data):
5256

5357
expected = 'STIMULUS_CODE'

tests/dataset/test_mies_nwb_data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ def get_value(self, key, sweep_num, default):
4242
ontology=ontology)
4343

4444

45+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
4546
def test_create_mies(mies_nwb_data):
4647
assert isinstance(mies_nwb_data, MIESNWBData)
4748

4849

50+
@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*")
4951
def test_get_sweep_metadata(mies_nwb_data):
5052

5153
expected = {

0 commit comments

Comments
 (0)