Skip to content

Commit

Permalink
Testing: Test import of future versions of files.
Browse files Browse the repository at this point in the history
  • Loading branch information
CSSFrancis authored and ericpre committed Nov 1, 2023
1 parent 1ac4a24 commit c4cbd16
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hyperspy/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,10 @@ def __init__(self,
obj : The {} that the event belongs to.
value : The new value
""".format(_name, _name, _name), arguments=["obj", 'value'])

if name is None:
name = t.Undefined
if units is None:
units = t.Undefined
self._suppress_value_changed_trigger = False
self._suppress_update_value = False
self.name = name
Expand Down
Binary file added hyperspy/tests/io/hdf5_files/future.hspy
Binary file not shown.
15 changes: 15 additions & 0 deletions hyperspy/tests/io/test_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,3 +997,18 @@ def test_more_recent_version_warning(tmp_path):
with pytest.warns(UserWarning):
s2 = load(filename)
np.testing.assert_allclose(s.data, s2.data)


def test_load_future():
"""Code for creating future.hspy with hyperspy version 2.0.0
import hyperspy.api as hs
import numpy as np
s = hs.signals.Signal2D(np.ones((10,10,10,10)))
pos = np.array([[np.random.randint(0,10, (np.random.randint(1,10),2)) for i in range(10)]for j in range(10)], dtype=object)
p = hs.plot.markers.Points(offsets = pos)
s.add_marker(p, permanent=True)
s.save("future.hspy")
"""
with pytest.warns(UserWarning):
future = load(filenames="hdf5_files/future.hspy")

0 comments on commit c4cbd16

Please sign in to comment.