aboutsummaryrefslogtreecommitdiff
path: root/tests/test_trace.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_trace.py')
-rw-r--r--tests/test_trace.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_trace.py b/tests/test_trace.py
index 981d1b7..3d77df3 100644
--- a/tests/test_trace.py
+++ b/tests/test_trace.py
@@ -1,3 +1,4 @@
+import pytest
from qolab.data.trace import loadTrace
import numpy as np
@@ -17,3 +18,19 @@ def test_load_gzip_compressed_v0dot1_trace():
data = tr.getData()
assert np.all( (data - np.array([[1], [3], [2], [5]])) == 0 )
+def test_tryCompressedIfMissing():
+ fname = 'tests/trace_test_data/only_compressed_file1.dat'
+ # first we check that the guess is working
+ tr = loadTrace(fname, tryCompressedIfMissing=True)
+ cfg = tr.getConfig()
+ assert cfg['config']['version'] == '0.1'
+ assert cfg['config']['model'] == 'Trace'
+ data = tr.getData()
+ assert np.all( (data - np.array([[1], [3], [2], [5]])) == 0 )
+
+ # now we disable search for compressed version
+ with pytest.raises(FileNotFoundError) as exc_info:
+ tr = loadTrace(fname, tryCompressedIfMissing=False)
+
+
+