6 from pybind11_tests
import pickling
as m
9 import cPickle
as pickle
14 @pytest.mark.parametrize(
"cls_name", [
"Pickleable",
"PickleableNew"])
21 data = pickle.dumps(p, 2)
22 p2 = pickle.loads(data)
23 assert p2.value() == p.value()
24 assert p2.extra1() == p.extra1()
25 assert p2.extra2() == p.extra2()
28 @pytest.mark.xfail(
"env.PYPY")
29 @pytest.mark.parametrize(
"cls_name", [
"PickleableWithDict",
"PickleableWithDictNew"])
34 p.dynamic =
"Attribute" 36 data = pickle.dumps(p, pickle.HIGHEST_PROTOCOL)
37 p2 = pickle.loads(data)
38 assert p2.value == p.value
39 assert p2.extra == p.extra
40 assert p2.dynamic == p.dynamic
44 from pybind11_tests
import enums
as e
45 data = pickle.dumps(e.EOne, 2)
46 assert e.EOne == pickle.loads(data)
def test_roundtrip(cls_name)
def test_roundtrip_with_dict(cls_name)
object getattr(handle obj, handle name)