summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-05-25 03:10:48 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-05-25 03:10:48 (GMT)
commit94c65d9a8ff8ec56c2420f46a6622803f7f1b154 (patch)
tree2b89b8c34e06c7a7c8b5b2076f551af956a0477e /Lib/test/test_descr.py
parent14a3dd716d2da4158739e502e8af8ef12e944cac (diff)
downloadcpython-94c65d9a8ff8ec56c2420f46a6622803f7f1b154.zip
cpython-94c65d9a8ff8ec56c2420f46a6622803f7f1b154.tar.gz
cpython-94c65d9a8ff8ec56c2420f46a6622803f7f1b154.tar.bz2
Merged revisions 72907 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72907 | benjamin.peterson | 2009-05-24 21:40:21 -0500 (Sun, 24 May 2009) | 1 line handle errors from _PyObject_LookupSpecial when __get__ fails ........
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 32f9090..adcb55f 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1595,7 +1595,11 @@ order (MRO) for bases """
def __get__(self, obj, owner):
record.append(1)
return self.impl.__get__(obj, owner)
-
+ class MyException(Exception):
+ pass
+ class ErrDescr(object):
+ def __get__(self, obj, owner):
+ raise MyException
for name, runner, meth_impl, ok, env in specials:
class X(Checker):
@@ -1614,6 +1618,18 @@ order (MRO) for bases """
runner(X())
self.assertEqual(record, [1], name)
+ class X(Checker):
+ pass
+ for attr, obj in env.items():
+ setattr(X, attr, obj)
+ setattr(X, name, ErrDescr())
+ try:
+ runner(X())
+ except MyException:
+ pass
+ else:
+ self.fail("{0!r} didn't raise".format(name))
+
def test_specials(self):
# Testing special operators...
# Test operators like __hash__ for which a built-in default exists