Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Oct 20, 2018
1 parent fc10bf9 commit 296c097
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.6.1
- tests: fix bad identification of data types
0.6.0
- BREAKING CHANGE: SeriesFolder file format does not load data files
recursively anymore
Expand Down
19 changes: 16 additions & 3 deletions tests/test_series_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,32 @@ def test_multiple_formats_error():
and test_multiple_formats_phasics_tif
should not be supported.
"""
# combine a zip file with a regular hologram file
path, _files2 = setup_folder_single_holo()
shutil.copy2(datapath / "series_phasics.zip", path)
other_fmt_path = path / "single_holo.npy"
np.save(other_fmt_path, np.zeros((10, 10)))
try:
qpformat.load_data(path)
except qpformat.file_formats.MultipleFormatsNotSupportedError:
pass
else:
assert False, "Multiple formats should raise error!"
assert False, "multiple formats should not be supported"
shutil.rmtree(path, ignore_errors=True)


def test_series_format_ignored():
"""Series file formats are ignored in SeriesFolder"""
# combine a zip file with a regular hologram file
path, _files2 = setup_folder_single_holo()
bad_path = datapath / "series_phasics.zip"
shutil.copy2(bad_path, path)
ds = qpformat.load_data(path)
assert len(ds) == 2
assert bad_path not in ds.files
shutil.rmtree(path, ignore_errors=True)


if __name__ == "__main__":
test_multiple_formats_error()
# Run all tests
loc = locals()
for key in list(loc.keys()):
Expand Down
10 changes: 0 additions & 10 deletions tests/test_storage_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@
import qpformat


def test_bad_folder():
path = pathlib.Path(__file__).parent / "data"
try:
qpformat.load_data(path)
except qpformat.file_formats.MultipleFormatsNotSupportedError:
pass
else:
raise ValueError("Multiple formats not supported")


def test_good_folder():
path = pathlib.Path(__file__).parent / "data"
dpath = pathlib.Path(tempfile.mkdtemp(prefix="qpformat_test_"))
Expand Down

0 comments on commit 296c097

Please sign in to comment.