summaryrefslogtreecommitdiff
path: root/Lib/test/test_property.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-04-13 21:27:19 -0400
committerR David Murray <rdmurray@bitdance.com>2012-04-13 21:27:19 -0400
commitea7bc055b08fb442986e0735b1b5b325b0b51ecc (patch)
tree20c2b837c787daf7e95ece075e6544627b17625a /Lib/test/test_property.py
parentc32365d2ce552d1d17279e30a564509235ffb1db (diff)
parentc2c9c905706160bf34aea12f2348210aac3e0da2 (diff)
downloadcpython-ea7bc055b08fb442986e0735b1b5b325b0b51ecc.tar.gz
Merge #14399: corrected news item
Diffstat (limited to 'Lib/test/test_property.py')
-rw-r--r--Lib/test/test_property.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_property.py b/Lib/test/test_property.py
index cc6a872179..726d6fee62 100644
--- a/Lib/test/test_property.py
+++ b/Lib/test/test_property.py
@@ -128,6 +128,29 @@ class PropertyTests(unittest.TestCase):
self.assertEqual(newgetter.spam, 8)
self.assertEqual(newgetter.__class__.spam.__doc__, "new docstring")
+ def test_property___isabstractmethod__descriptor(self):
+ for val in (True, False, [], [1], '', '1'):
+ class C(object):
+ def foo(self):
+ pass
+ foo.__isabstractmethod__ = val
+ foo = property(foo)
+ self.assertIs(C.foo.__isabstractmethod__, bool(val))
+
+ # check that the property's __isabstractmethod__ descriptor does the
+ # right thing when presented with a value that fails truth testing:
+ class NotBool(object):
+ def __nonzero__(self):
+ raise ValueError()
+ __len__ = __nonzero__
+ with self.assertRaises(ValueError):
+ class C(object):
+ def foo(self):
+ pass
+ foo.__isabstractmethod__ = NotBool()
+ foo = property(foo)
+ C.foo.__isabstractmethod__
+
# Issue 5890: subclasses of property do not preserve method __doc__ strings
class PropertySub(property):