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

Method test_wrong_newobj_class

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

Source from the content-addressed store, hash-verified

1870 f'when serializing {REX.__module__}.REX object'])
1871
1872 def test_wrong_newobj_class(self):
1873 obj = REX((copyreg.__newobj__, (str,)))
1874 for proto in protocols[2:]:
1875 with self.subTest(proto=proto):
1876 with self.assertRaises(pickle.PicklingError) as cm:
1877 self.dumps(obj, proto)
1878 self.assertEqual(str(cm.exception),
1879 f'first argument to __newobj__() must be {REX!r}, not {str!r}')
1880 self.assertEqual(cm.exception.__notes__, [
1881 f'when serializing {REX.__module__}.REX object'])
1882
1883 def test_unpickleable_newobj_class(self):
1884 class LocalREX(REX): pass

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