(cls_name)
| 50 | |
| 51 | @pytest.mark.parametrize("cls_name", ["Pickleable", "PickleableNew"]) |
| 52 | def test_roundtrip(cls_name): |
| 53 | cls = getattr(m, cls_name) |
| 54 | p = cls("test_value") |
| 55 | p.setExtra1(15) |
| 56 | p.setExtra2(48) |
| 57 | |
| 58 | data = pickle.dumps(p, 2) # Must use pickle protocol >= 2 |
| 59 | p2 = pickle.loads(data) |
| 60 | assert p2.value() == p.value() |
| 61 | assert p2.extra1() == p.extra1() |
| 62 | assert p2.extra2() == p.extra2() |
| 63 | |
| 64 | |
| 65 | @pytest.mark.xfail("env.PYPY") |