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

Method test_bad_reconstructor

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

Source from the content-addressed store, hash-verified

1790 f'when serializing {REX.__module__}.REX object'])
1791
1792 def test_bad_reconstructor(self):
1793 obj = REX((42, ()))
1794 for proto in protocols:
1795 with self.subTest(proto=proto):
1796 with self.assertRaises(pickle.PicklingError) as cm:
1797 self.dumps(obj, proto)
1798 self.assertEqual(str(cm.exception),
1799 'first item of the tuple returned by __reduce__ '
1800 'must be callable, not int')
1801 self.assertEqual(cm.exception.__notes__, [
1802 f'when serializing {REX.__module__}.REX object'])
1803
1804 def test_unpickleable_reconstructor(self):
1805 obj = REX((UnpickleableCallable(), ()))

Callers

nothing calls this directly

Calls 6

REXClass · 0.85
strFunction · 0.85
subTestMethod · 0.45
assertRaisesMethod · 0.45
dumpsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected