MCPcopy Index your code
hub / github.com/python/cpython / test_misc

Method test_misc

Lib/test/pickletester.py:2565–2590  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2563 assert_is_copy = AbstractUnpickleTests.assert_is_copy
2564
2565 def test_misc(self):
2566 # test various datatypes not tested by testdata
2567 for proto in protocols:
2568 with self.subTest('myint', proto=proto):
2569 if self.py_version < (3, 0) and proto < 2:
2570 self.skipTest('int subclasses are not interoperable with Python 2')
2571 x = myint(4)
2572 s = self.dumps(x, proto)
2573 y = self.loads(s)
2574 self.assert_is_copy(x, y)
2575
2576 with self.subTest('tuple', proto=proto):
2577 x = (1, ())
2578 s = self.dumps(x, proto)
2579 y = self.loads(s)
2580 self.assert_is_copy(x, y)
2581
2582 with self.subTest('initarg', proto=proto):
2583 if self.py_version < (3, 0):
2584 self.skipTest('"classic" classes are not interoperable with Python 2')
2585 x = initarg(1, x)
2586 s = self.dumps(x, proto)
2587 y = self.loads(s)
2588 self.assert_is_copy(x, y)
2589
2590 # XXX test __reduce__ protocol?
2591
2592 def test_roundtrip_equality(self):
2593 if self.py_version < (3, 0):

Callers

nothing calls this directly

Calls 7

initargClass · 0.85
skipTestMethod · 0.80
assert_is_copyMethod · 0.80
myintClass · 0.70
subTestMethod · 0.45
dumpsMethod · 0.45
loadsMethod · 0.45

Tested by

no test coverage detected