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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
7619f085
Commit
7619f085
authored
Aug 26, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extended getattr test case
parent
a998bfe5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
18 deletions
+38
-18
tests/run/getattr3call.pyx
tests/run/getattr3call.pyx
+38
-18
No files found.
tests/run/getattr3call.pyx
View file @
7619f085
__doc__
=
u"""
>>> class test(object): a = 1
>>> t = test()
>>> f(t, 'a')
class
test
(
object
):
a
=
1
t
=
test
()
def
getattr2_literal_unicode
(
a
):
"""
>>> getattr2_literal_unicode(t)
1
>>>
f(t, 'b'
)
>>>
getattr2_literal_unicode(object()
)
Traceback (most recent call last):
AttributeError: 'test' object has no attribute 'b'
AttributeError: 'object' object has no attribute 'a'
"""
return
getattr
(
a
,
u"a"
)
>>> g(t, 'a', 2)
1
>>> g(t, 'b', 2)
2
def
getattr3_literal_unicode
(
a
,
b
):
"""
>>> getattr3_literal_unicode(t, 2)
(1, 2)
"""
return
getattr
(
a
,
u"a"
,
b
),
getattr
(
a
,
u"b"
,
b
)
>>> h(t, 'a', 2)
def
getattr2_simple
(
a
,
b
):
"""
>>> getattr2_simple(t, 'a')
1
>>> h(t, 'b', 2)
2
"""
def
f
(
a
,
b
):
>>> getattr2_simple(t, 'b')
Traceback (most recent call last):
AttributeError: 'test' object has no attribute 'b'
"""
return
getattr
(
a
,
b
)
def
g
(
a
,
b
,
c
):
def
getattr3_explicit
(
a
,
b
,
c
):
"""
>>> getattr3_explicit(t, 'a', 2)
1
>>> getattr3_explicit(t, 'b', 2)
2
"""
return
getattr3
(
a
,
b
,
c
)
def
h
(
a
,
b
,
c
):
def
getattr3_args
(
a
,
b
,
c
):
"""
>>> getattr3_args(t, 'a', 2)
1
>>> getattr3_args(t, 'b', 2)
2
"""
return
getattr
(
a
,
b
,
c
)
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