Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
e8a5b5fc
Commit
e8a5b5fc
authored
Oct 18, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test case cleanup
parent
ecf22d5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
19 deletions
+22
-19
tests/run/__getattribute__.pyx
tests/run/__getattribute__.pyx
+22
-19
No files found.
tests/run/__getattribute__.pyx
View file @
e8a5b5fc
__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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment