diff options
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 18 |
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 |