diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-06-19 23:03:37 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-06-19 23:03:37 -0400 |
commit | 93f893f3cd58549e7127c1ef9a2a6f1064b459bc (patch) | |
tree | 2a88af9c2ca1cb4ad27a7fc69ca05dfc2580af86 /tests | |
parent | 43f93128ca139d9132c244e11b981ab8f47fa684 (diff) | |
download | qolab-93f893f3cd58549e7127c1ef9a2a6f1064b459bc.tar.gz qolab-93f893f3cd58549e7127c1ef9a2a6f1064b459bc.zip |
simplified test for trace
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_trace.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/tests/test_trace.py b/tests/test_trace.py index 3d77df3..24c96c5 100644 --- a/tests/test_trace.py +++ b/tests/test_trace.py @@ -2,31 +2,27 @@ import pytest from qolab.data.trace import loadTrace import numpy as np -def test_load_uncompressed_v0dot1_trace(): - tr = loadTrace('tests/trace_test_data/xtrace1.dat') +def isItExpectedTrace(tr): 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 ) + return True + +def test_load_uncompressed_v0dot1_trace(): + tr = loadTrace('tests/trace_test_data/xtrace1.dat') + assert isItExpectedTrace(tr) == True def test_load_gzip_compressed_v0dot1_trace(): tr = loadTrace('tests/trace_test_data/xtrace1.dat.gz') - 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 ) + assert isItExpectedTrace(tr) == True 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 ) + assert isItExpectedTrace(tr) == True # now we disable search for compressed version with pytest.raises(FileNotFoundError) as exc_info: |