1+ import pytest
2+ from packaging .version import Version
13from pynwb .icephys import IntracellularElectrode
24from pynwb .device import Device
35
46from nwbinspector import InspectorMessage , Importance , check_intracellular_electrode_cell_id_exists
7+ from nwbinspector .utils import get_package_version
58
9+ PYNWB_VERSION_LOWER_2_1_0 = get_package_version (name = "pynwb" ) < Version ("2.1.0" )
10+ PYNWB_VERSION_LOWER_SKIP_REASON = "This test requires PyNWB>=2.1.0"
611
12+
13+ @pytest .mark .skipif (PYNWB_VERSION_LOWER_2_1_0 , reason = PYNWB_VERSION_LOWER_SKIP_REASON )
714def test_pass_check_intracellular_electrode_cell_id_exists ():
815 device = Device (name = "device" )
916 ielec = IntracellularElectrode (name = "ielec" , cell_id = "123" , device = device , description = "an intracellular electrode" )
1017 assert check_intracellular_electrode_cell_id_exists (ielec ) is None
1118
1219
20+ @pytest .mark .skipif (PYNWB_VERSION_LOWER_2_1_0 , reason = PYNWB_VERSION_LOWER_SKIP_REASON )
1321def test_fail_check_intracellular_electrode_cell_id_exists ():
1422 device = Device (name = "device" )
1523 ielec = IntracellularElectrode (name = "ielec" , device = device , description = "an intracellular electrode" )
@@ -21,3 +29,10 @@ def test_fail_check_intracellular_electrode_cell_id_exists():
2129 object_name = "ielec" ,
2230 location = "/" ,
2331 )
32+
33+
34+ @pytest .mark .skipif (not PYNWB_VERSION_LOWER_2_1_0 , reason = "This test requires PyNWB<2.1.0" )
35+ def test_skip_check_for_lower_versions ():
36+ device = Device (name = "device" )
37+ ielec = IntracellularElectrode (name = "ielec" , device = device , description = "an intracellular electrode" )
38+ assert check_intracellular_electrode_cell_id_exists (ielec ) is None
0 commit comments