only accept AttributeError as indicating no __prepare__ attribute on a metaclass, allowing lookup errors to propogate

This commit is contained in:
Benjamin Peterson 2010-02-27 17:40:01 +00:00
parent 8de42e2d50
commit 23e018ab98
3 changed files with 26 additions and 2 deletions

View file

@ -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}