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
49d33ef7
Commit
49d33ef7
authored
Mar 23, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better test case
parent
83ecf76f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
0 deletions
+78
-0
tests/run/iterdict.pyx
tests/run/iterdict.pyx
+78
-0
No files found.
tests/run/iterdict.pyx
View file @
49d33ef7
cimport
cython
dict_size
=
4
d
=
dict
(
zip
(
range
(
10
,
dict_size
+
10
),
range
(
dict_size
)))
@
cython
.
test_fail_if_path_exists
(
"//WhileStatNode"
)
def
items
(
dict
d
):
"""
>>> items(d)
...
...
@@ -12,6 +17,10 @@ def items(dict d):
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
iteritems
(
dict
d
):
"""
>>> iteritems(d)
...
...
@@ -23,6 +32,10 @@ def iteritems(dict d):
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
iteritems_int
(
dict
d
):
"""
>>> iteritems_int(d)
...
...
@@ -35,6 +48,10 @@ def iteritems_int(dict d):
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
iteritems_tuple
(
dict
d
):
"""
>>> iteritems_tuple(d)
...
...
@@ -46,11 +63,19 @@ def iteritems_tuple(dict d):
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
iteritems_listcomp
(
dict
d
):
cdef
list
l
=
[(
k
,
v
)
for
k
,
v
in
d
.
iteritems
()]
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
iterkeys
(
dict
d
):
"""
>>> iterkeys(d)
...
...
@@ -62,6 +87,10 @@ def iterkeys(dict d):
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
iterkeys_int
(
dict
d
):
"""
>>> iterkeys_int(d)
...
...
@@ -74,6 +103,10 @@ def iterkeys_int(dict d):
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
iterdict
(
dict
d
):
"""
>>> iterdict(d)
...
...
@@ -85,6 +118,10 @@ def iterdict(dict d):
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
iterdict_int
(
dict
d
):
"""
>>> iterdict_int(d)
...
...
@@ -97,6 +134,10 @@ def iterdict_int(dict d):
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
iterdict_reassign
(
dict
d
):
"""
>>> iterdict_reassign(d)
...
...
@@ -110,11 +151,23 @@ def iterdict_reassign(dict d):
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
iterdict_listcomp
(
dict
d
):
"""
>>> iterdict_listcomp(d)
[10, 11, 12, 13]
"""
cdef
list
l
=
[
k
for
k
in
d
]
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
itervalues
(
dict
d
):
"""
>>> itervalues(d)
...
...
@@ -126,6 +179,10 @@ def itervalues(dict d):
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
itervalues_int
(
dict
d
):
"""
>>> itervalues_int(d)
...
...
@@ -138,7 +195,28 @@ def itervalues_int(dict d):
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
itervalues_listcomp
(
dict
d
):
"""
>>> itervalues_listcomp(d)
[0, 1, 2, 3]
"""
cdef
list
l
=
[
v
for
v
in
d
.
itervalues
()]
l
.
sort
()
return
l
@
cython
.
test_assert_path_exists
(
"//WhileStatNode"
,
"//WhileStatNode/SimpleCallNode"
,
"//WhileStatNode/SimpleCallNode/NameNode"
)
def
itervalues_kwargs
(
**
d
):
"""
>>> itervalues_kwargs(a=1, b=2, c=3, d=4)
[1, 2, 3, 4]
"""
cdef
list
l
=
[
v
for
v
in
d
.
itervalues
()]
l
.
sort
()
return
l
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