Loading src/imars3d/backend/dataio/data.py +2 −2 Original line number Diff line number Diff line Loading @@ -191,8 +191,8 @@ class load_data(param.ParameterizedFunction): ) elif sigs.intersection(ref) == {"files", "dir"}: logger.error("Files and dir cannot be used at the same time") raise ValueError("Mix usage of allowed signature.") logger.error("Other cases of files and dir cannot be used at the same time") raise ValueError("Mix signatures not allowed") elif sigs.intersection(ref) == {"files"}: logger.debug("Load by file list") Loading tests/unit/backend/dataio/test_data.py +6 −7 Original line number Diff line number Diff line Loading @@ -97,8 +97,7 @@ def test_load_data( # error_0: incorrect input argument types with pytest.raises(ValueError): load_data(ct_files=1, ob_files=[], dc_files=[]) load_data(ct_dir=1, ob_files=[], dc_files=[]) load_data(ct_dir="does_not_exist", ob_files=[], dc_files=[]) load_data(ct_dir=1, ob_files=[]) load_data(ct_files=[], ob_files=[], dc_files=[], ct_fnmatch=1) load_data(ct_files=[], ob_files=[], dc_files=[], ob_fnmatch=1) load_data(ct_files=[], ob_files=[], dc_files=[], dc_fnmatch=1) Loading @@ -111,15 +110,15 @@ def test_load_data( # error_3: no valid signature found with pytest.raises(ValueError): load_data(ct_fnmatch=1) # case_0: load data from file list # case_0: load ct from directory, ob and dc from files rst = load_data(ct_dir="/tmp", ob_files=["3", "4"], dc_files=["5", "6"]) np.testing.assert_almost_equal(np.array(rst).flatten(), np.arange(1, 5, dtype=float)) # case_1: load data from file list rst = load_data(ct_files=["1", "2"], ob_files=["3", "4"], dc_files=["5", "6"]) np.testing.assert_almost_equal(np.array(rst).flatten(), np.arange(1, 5, dtype=float)) # case_1: load data from given directory # case_2: load data from given directory rst = load_data(ct_dir="/tmp", ob_dir="/tmp", dc_dir="/tmp") np.testing.assert_almost_equal(np.array(rst).flatten(), np.arange(1, 5, dtype=float)) # case_2: load ct from directory, ob and dc from files rst = load_data(ct_dir="/tmp", ob_files=["3", "4"], dc_files=["5", "6"]) np.testing.assert_almost_equal(np.array(rst).flatten(), np.arange(1, 5, dtype=float)) def test_forgiving_reader(): Loading Loading
src/imars3d/backend/dataio/data.py +2 −2 Original line number Diff line number Diff line Loading @@ -191,8 +191,8 @@ class load_data(param.ParameterizedFunction): ) elif sigs.intersection(ref) == {"files", "dir"}: logger.error("Files and dir cannot be used at the same time") raise ValueError("Mix usage of allowed signature.") logger.error("Other cases of files and dir cannot be used at the same time") raise ValueError("Mix signatures not allowed") elif sigs.intersection(ref) == {"files"}: logger.debug("Load by file list") Loading
tests/unit/backend/dataio/test_data.py +6 −7 Original line number Diff line number Diff line Loading @@ -97,8 +97,7 @@ def test_load_data( # error_0: incorrect input argument types with pytest.raises(ValueError): load_data(ct_files=1, ob_files=[], dc_files=[]) load_data(ct_dir=1, ob_files=[], dc_files=[]) load_data(ct_dir="does_not_exist", ob_files=[], dc_files=[]) load_data(ct_dir=1, ob_files=[]) load_data(ct_files=[], ob_files=[], dc_files=[], ct_fnmatch=1) load_data(ct_files=[], ob_files=[], dc_files=[], ob_fnmatch=1) load_data(ct_files=[], ob_files=[], dc_files=[], dc_fnmatch=1) Loading @@ -111,15 +110,15 @@ def test_load_data( # error_3: no valid signature found with pytest.raises(ValueError): load_data(ct_fnmatch=1) # case_0: load data from file list # case_0: load ct from directory, ob and dc from files rst = load_data(ct_dir="/tmp", ob_files=["3", "4"], dc_files=["5", "6"]) np.testing.assert_almost_equal(np.array(rst).flatten(), np.arange(1, 5, dtype=float)) # case_1: load data from file list rst = load_data(ct_files=["1", "2"], ob_files=["3", "4"], dc_files=["5", "6"]) np.testing.assert_almost_equal(np.array(rst).flatten(), np.arange(1, 5, dtype=float)) # case_1: load data from given directory # case_2: load data from given directory rst = load_data(ct_dir="/tmp", ob_dir="/tmp", dc_dir="/tmp") np.testing.assert_almost_equal(np.array(rst).flatten(), np.arange(1, 5, dtype=float)) # case_2: load ct from directory, ob and dc from files rst = load_data(ct_dir="/tmp", ob_files=["3", "4"], dc_files=["5", "6"]) np.testing.assert_almost_equal(np.array(rst).flatten(), np.arange(1, 5, dtype=float)) def test_forgiving_reader(): Loading