Commit eb0d1287 authored by Tactac, Kevin's avatar Tactac, Kevin
Browse files

local tests pass

parent c96867f4
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -59,14 +59,21 @@ class Foldernames(param.Foldername):
    * any of the paths searched by resolve_dir_path() (if search_paths is None).
    """

    def _validate(self, val):

        if isinstance(val, (list, tuple)):
            for v in val:
                super()._validate(v)
        else:
            super()._validate(val)

    def _resolve(self, paths):
        if isinstance(paths, (str, Path)):
            return super()._resolve(paths)
        elif isinstance(paths, (list, tuple)):

        if isinstance(paths, (list, tuple)):
            return [self._resolve(path) for path in paths]
        else:
            name = next(x for x in [self.name, self.label, "Foldernames parameter"] if x)
            raise ValueError(f"{name} must be a string or a list of strings")
            return super()._resolve(paths)



class load_data(param.ParameterizedFunction):
+2 −1
Original line number Diff line number Diff line
@@ -69,7 +69,8 @@ def test_Foldernames(tmpdir):
    # test wrong input
    with pytest.raises(ValueError) as e:
        TestFoldernames(f=open(tmpdir / "temp.txt", "w"))
    assert str(e.value) == "f must be a string or a list of strings"

    assert str(e.value) == "Foldernames parameter 'TestFoldernames.f' only take str or pathlib.Path types"
    # test single directory
    tf = TestFoldernames(f=str(tmpdir))
    assert tf.f == str(tmpdir)
+1 −1
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ def test_apply_tilt_correction():
def test_tilt_correction():
    # error_0: incorrect dimension
    with pytest.raises(ValueError):
        tilt_correction(arrays=np.arange(10), tilt=1.0)
        tilt_correction(arrays=np.arange(10))
    # make synthetic data
    size = 100
    rot_axis_ideal = get_tilted_rot_axis(0, 0)