Skip to content

Commit

Permalink
test: tested rtdc_dataset.config.Configuration is pickable (close #190)…
Browse files Browse the repository at this point in the history
… (#243)
  • Loading branch information
maxschloegel authored Nov 28, 2023
1 parent 8ee2099 commit c09d74a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
0.55.7
- test: tested rtdc_dataset.config.Configuration is pickable (#190)
- enh: add dcnum pipeline identifier metadata constants
0.55.6
- fix: default `host` was overriding URL host in fmt_dcor
Expand Down
15 changes: 15 additions & 0 deletions tests/test_rtdc_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test functions for RT-DC configuration metadata"""
import os
import pathlib
import pickle
import tempfile
import warnings

Expand Down Expand Up @@ -31,6 +32,8 @@ def equals(a, b):
assert np.isnan(b)
else:
assert np.allclose(a, b), "a={} vs b={}".format(a, b)
elif isinstance(a, np.ndarray):
assert np.all(a == b), f"{a=} vs {b=}"
else:
assert a == b, "a={} vs b={}".format(a, b)
return True
Expand Down Expand Up @@ -60,6 +63,18 @@ def test_config_invalid_key():
assert "invalid_key" in str(w[-1].message)


@pytest.mark.filterwarnings(
"ignore::dclab.rtdc_dataset.config.WrongConfigurationTypeWarning")
@pytest.mark.filterwarnings(
"ignore::dclab.rtdc_dataset.config.UnknownConfigurationKeyWarning")
@pytest.mark.parametrize("path", list(data_path.glob("fmt-hdf5_*.zip")))
def test_config_pickle(path):
ds = new_dataset(retrieve_data(path.name))
cfg_pkl = pickle.dumps(ds.config)
cfg_unpkl = pickle.loads(cfg_pkl)
assert equals(ds.config, cfg_unpkl)


def test_config_save_load():
pytest.importorskip("nptdms")
# Download and extract data
Expand Down

0 comments on commit c09d74a

Please sign in to comment.