summaryrefslogtreecommitdiff
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorJeroen Demeyer <J.Demeyer@UGent.be>2019-09-10 13:21:57 +0200
committerT. Wouters <thomas@python.org>2019-09-10 04:21:57 -0700
commit57ea33560662e0f20a3b0334bb20065771edf4da (patch)
tree5a8e4a23ec325a2a8ba6c121a123cd97339cbf06 /Lib/test/test_descr.py
parentf958377b67c36a98d4df67b94c01eb29e3104f61 (diff)
downloadcpython-git-57ea33560662e0f20a3b0334bb20065771edf4da.tar.gz
bpo-37619: update_one_slot() should not ignore wrapper descriptors for wrong type (GH-14836)
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 4368bb585f..796e60a770 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -4649,6 +4649,18 @@ order (MRO) for bases """
self.assertEqual(x["y"], 42)
self.assertEqual(x, -x)
+ def test_wrong_class_slot_wrapper(self):
+ # Check bpo-37619: a wrapper descriptor taken from the wrong class
+ # should raise an exception instead of silently being ignored
+ class A(int):
+ __eq__ = str.__eq__
+ __add__ = str.__add__
+ a = A()
+ with self.assertRaises(TypeError):
+ a == a
+ with self.assertRaises(TypeError):
+ a + a
+
def test_slot_shadows_class_variable(self):
with self.assertRaises(ValueError) as cm:
class X: