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

Method test_object_reduce

Lib/test/test_descr.py:5977–5988  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5975 self.assertEqual(A().__reduce_ex__(2), expected) # Shouldn't crash
5976
5977 def test_object_reduce(self):
5978 # Issue #29914
5979 # __reduce__() takes no arguments
5980 object().__reduce__()
5981 with self.assertRaises(TypeError):
5982 object().__reduce__(0)
5983 # __reduce_ex__() takes one integer argument
5984 object().__reduce_ex__(0)
5985 with self.assertRaises(TypeError):
5986 object().__reduce_ex__()
5987 with self.assertRaises(TypeError):
5988 object().__reduce_ex__(None)
5989
5990
5991class SharedKeyTests(unittest.TestCase):

Callers

nothing calls this directly

Calls 3

__reduce__Method · 0.45
assertRaisesMethod · 0.45
__reduce_ex__Method · 0.45

Tested by

no test coverage detected