Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pickling state #6245

Merged
merged 7 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion holoviews/core/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ def __setstate__(self, d):
self.param.warning("Could not unpickle custom style information.")
d['_id'] = opts_id
self.__dict__.update(d)
super().__setstate__({})
super().__setstate__(d)
philippjfr marked this conversation as resolved.
Show resolved Hide resolved


class Dimensioned(LabelledData):
Expand Down
10 changes: 10 additions & 0 deletions holoviews/tests/core/test_dimensioned.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import gc
import pickle

from holoviews.core.element import Element
from holoviews.core.options import Keywords, Options, OptionTree, Store
from holoviews.core.spaces import HoloMap
from holoviews.element.chart import Curve

from ..utils import LoggingComparisonTestCase

Expand Down Expand Up @@ -258,3 +260,11 @@ def test_opts_clear_cleans_unused_tree(self):
ExampleElement([]).opts(style_opt1='A').opts.clear()
custom_options = Store._custom_options['backend_1']
self.assertEqual(len(custom_options), 0)

class TestGetSetState:

def test_pickle_roundtrip(self):
curve = Curve([0, 1, 2], kdims=["XAXIS"])
roundtrip_curve = pickle.loads(pickle.dumps(curve))
assert curve.kdims == roundtrip_curve.kdims
assert curve.vdims == roundtrip_curve.vdims
Loading