summaryrefslogtreecommitdiff
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 92553e3573..ced25f3fc4 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -5236,7 +5236,20 @@ class PicklingTests(unittest.TestCase):
import copyreg
expected = (copyreg.__newobj__, (A,), (None, {'spam': 42}), None, None)
- self.assertEqual(A().__reduce__(2), expected) # Shouldn't crash
+ self.assertEqual(A().__reduce_ex__(2), expected) # Shouldn't crash
+
+ def test_object_reduce(self):
+ # Issue #29914
+ # __reduce__() takes no arguments
+ object().__reduce__()
+ with self.assertRaises(TypeError):
+ object().__reduce__(0)
+ # __reduce_ex__() takes one integer argument
+ object().__reduce_ex__(0)
+ with self.assertRaises(TypeError):
+ object().__reduce_ex__()
+ with self.assertRaises(TypeError):
+ object().__reduce_ex__(None)
class SharedKeyTests(unittest.TestCase):