Commit e8a5b5fc authored by Stefan Behnel's avatar Stefan Behnel

test case cleanup

parent ecf22d5a
__doc__ = u"""
__getattribute__ and __getattr__ special methods for a single class.
"""
cdef class just_getattribute:
"""
>>> a = just_getattribute()
>>> a.bar
'bar'
>>> a.invalid
Traceback (most recent call last):
AttributeError
"""
def __getattribute__(self,n):
if n == 'bar':
return n
else:
raise AttributeError
cdef class just_getattr:
"""
>>> a = just_getattr()
>>> a.foo
10
......@@ -16,25 +27,7 @@ __getattribute__ and __getattr__ special methods for a single class.
>>> a.invalid
Traceback (most recent call last):
AttributeError
>>> a = both()
>>> a.foo
10
>>> a.bar
'bar'
>>> a.invalid
Traceback (most recent call last):
AttributeError
"""
cdef class just_getattribute:
def __getattribute__(self,n):
if n == 'bar':
return n
else:
raise AttributeError
cdef class just_getattr:
"""
cdef readonly int foo
def __init__(self):
self.foo = 10
......@@ -45,6 +38,16 @@ cdef class just_getattr:
raise AttributeError
cdef class both:
"""
>>> a = both()
>>> a.foo
10
>>> a.bar
'bar'
>>> a.invalid
Traceback (most recent call last):
AttributeError
"""
cdef readonly int foo
def __init__(self):
self.foo = 10
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment