def test_simple_qpseries(): path = setup_test_data_recursive(n=2, num=3) ps = dialog.recursive_search(path) assert len(ps) == 2 # make sure files are the right ones for ii in range(len(ps)): with qpimage.QPSeries(h5file=ps[ii], h5mode="r") as qps: assert len(qps) == 3
def test_complex_qpseries(): path = tempfile.mkdtemp(prefix="drymass_test_cli_recurse2_") path = pathlib.Path(path) paths = [path / "1" / "2", path / "3", path / "4" / "5" / "6"] for pp in paths: pp.mkdir(parents=True, exist_ok=True) setup_test_data(path_in=pp / "test.h5") ps = dialog.recursive_search(path) for ii, pi in enumerate(ps): assert pi.samefile(paths[ii] / "test.h5")
def test_qpseries_with_bad_data(): path = setup_test_data_recursive(n=2, num=3) (path / "bad_data.h5").write_text("This file should be ignored.") ps = dialog.recursive_search(path) assert len(ps) == 2 # make sure files are the right ones for ii in range(len(ps)): with qpimage.QPSeries(h5file=ps[ii], h5mode="r") as qps: assert len(qps) == 3
def test_recursive_root_include2(): path = tempfile.mkdtemp(prefix="drymass_test_cli_recurse2_") path = pathlib.Path(path) # this file will be ignored qpi, ignored_path, _ = setup_test_data(num=1, path_in=path / "test.h5") for ii in range(4): qpi.copy(h5file=path / "test_{}.h5".format(ii)) ps = dialog.recursive_search(path) assert len(ps) == 1 assert ignored_path not in ps ds = qpformat.load_data(path=path) assert len(ds) == 4
def test_complex_folder_with_unused_qpseries(): path = tempfile.mkdtemp(prefix="drymass_test_cli_recurse2_") path = pathlib.Path(path) qpi, path0, _ = setup_test_data(num=1, path_in=path / "test.h5") path = pathlib.Path(path) paths = [path / "1" / "2", path / "3", path / "4" / "5" / "6"] for pp in paths: pp.mkdir(parents=True, exist_ok=True) for ii in range(4): qpi.copy(h5file=pp / "test_{}.h5".format(ii)) ps = dialog.recursive_search(path) for ii, pi in enumerate(paths): assert pi.samefile(ps[ii]) assert path0.samefile(ps[3])
def test_recursive_root_include1(): qpi, path_in, path_out = setup_test_data(num=2) ps = dialog.recursive_search(path_in) assert len(ps) == 1 assert ps[0].samefile(path_in)