diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-02-27 17:40:01 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-02-27 17:40:01 (GMT) |
commit | 23e018ab9893369e7669631af16016b83b0de09b (patch) | |
tree | c9d25a600019030cee49f5c9390fd352b4cc59ff /Lib/test/test_metaclass.py | |
parent | 8de42e2d50e9609ef4f9a656a0b8e1234db969ac (diff) | |
download | cpython-23e018ab9893369e7669631af16016b83b0de09b.zip cpython-23e018ab9893369e7669631af16016b83b0de09b.tar.gz cpython-23e018ab9893369e7669631af16016b83b0de09b.tar.bz2 |
only accept AttributeError as indicating no __prepare__ attribute on a metaclass, allowing lookup errors to propogate
Diffstat (limited to 'Lib/test/test_metaclass.py')
-rw-r--r-- | Lib/test/test_metaclass.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_metaclass.py b/Lib/test/test_metaclass.py index 000bcf5..219ab99 100644 --- a/Lib/test/test_metaclass.py +++ b/Lib/test/test_metaclass.py @@ -230,6 +230,20 @@ Make sure it works with subclassing. 42 >>> +Test failures in looking up the __prepare__ method work. + >>> class ObscureException(Exception): + ... pass + >>> class FailDescr: + ... def __get__(self, instance, owner): + ... raise ObscureException + >>> class Meta(type): + ... __prepare__ = FailDescr() + >>> class X(metaclass=Meta): + ... pass + Traceback (most recent call last): + [...] + test.test_metaclass.ObscureException + """ __test__ = {'doctests' : doctests} |