Skip to content

Commit

Permalink
tests: try to reproduce identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jul 16, 2018
1 parent 5ac4b62 commit 69644bb
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,19 @@
import qpformat.core


datapath = pathlib.Path(__file__).parent / "data"


def test_identifier():
data = np.ones((20, 20), dtype=float)
tf = tempfile.mktemp(prefix="qpformat_test_", suffix=".npy")
np.save(tf, data)
path = datapath / "series_phasics.zip"

ds1 = qpformat.load_data(path=tf)
assert ds1.identifier == "b92ea"
ds1 = qpformat.load_data(path=path)
assert ds1.identifier == "7fc65"

bg_data = ds1.get_qpimage(0)
ds2 = qpformat.load_data(path=tf, bg_data=bg_data)
assert ds2.background_identifier == "0515f"
assert ds2.identifier == "4b53f"

# cleanup
try:
os.remove(tf)
except OSError:
pass
ds2 = qpformat.load_data(path=path, bg_data=bg_data)
assert ds2.background_identifier == "3f328"
assert ds2.identifier == "1e92f"


def test_meta():
Expand Down

0 comments on commit 69644bb

Please sign in to comment.