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
Kirill Smelkov
cython
Commits
678b2296
Commit
678b2296
authored
Nov 28, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extended test cases
parent
02e16427
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
tests/run/dict.pyx
tests/run/dict.pyx
+32
-0
tests/run/listcomp.pyx
tests/run/listcomp.pyx
+10
-2
No files found.
tests/run/dict.pyx
View file @
678b2296
...
@@ -15,6 +15,25 @@ __doc__ = u"""
...
@@ -15,6 +15,25 @@ __doc__ = u"""
resting
resting
>>> print(constant()['answer'])
>>> print(constant()['answer'])
42
42
>>> print(dict_call()['parrot'])
resting
>>> print(dict_call()['answer'])
42
>>> print(dict_call_dict()['parrot'])
resting
>>> print(dict_call_dict()['answer'])
42
>>> print(dict_call_kwargs()['parrot1'])
resting
>>> print(dict_call_kwargs()['parrot2'])
resting
>>> print(dict_call_kwargs()['answer1'])
42
>>> print(dict_call_kwargs()['answer2'])
42
"""
"""
def
empty
():
def
empty
():
...
@@ -36,3 +55,16 @@ def keyvalues2(key1, value1, key2, value2):
...
@@ -36,3 +55,16 @@ def keyvalues2(key1, value1, key2, value2):
def
constant
():
def
constant
():
d
=
{
u"parrot"
:
u"resting"
,
u"answer"
:
42
}
d
=
{
u"parrot"
:
u"resting"
,
u"answer"
:
42
}
return
d
return
d
def
dict_call
():
d
=
dict
(
parrot
=
u"resting"
,
answer
=
42
)
return
d
def
dict_call_dict
():
d
=
dict
(
dict
(
parrot
=
u"resting"
,
answer
=
42
))
return
d
def
dict_call_kwargs
():
kwargs
=
dict
(
parrot1
=
u"resting"
,
answer1
=
42
)
d
=
dict
(
parrot2
=
u"resting"
,
answer2
=
42
,
**
kwargs
)
return
d
tests/run/listcomp.pyx
View file @
678b2296
...
@@ -3,14 +3,22 @@ u"""
...
@@ -3,14 +3,22 @@ u"""
[0, 4, 8]
[0, 4, 8]
>>> typed()
>>> typed()
[A, A, A]
[A, A, A]
>>> iterdict()
[1, 2, 3]
"""
"""
def
smoketest
():
def
smoketest
():
print
[
x
*
2
for
x
in
range
(
5
)
if
x
%
2
==
0
]
print
[
x
*
2
for
x
in
range
(
5
)
if
x
%
2
==
0
]
cdef
class
A
:
cdef
class
A
:
def
__repr__
(
self
):
return
"A"
def
__repr__
(
self
):
return
u
"A"
def
typed
():
def
typed
():
cdef
A
obj
cdef
A
obj
print
[
obj
for
obj
in
[
A
(),
A
(),
A
()]]
print
[
obj
for
obj
in
[
A
(),
A
(),
A
()]]
def
iterdict
():
cdef
dict
d
=
dict
(
a
=
1
,
b
=
2
,
c
=
3
)
l
=
[
d
[
key
]
for
key
in
d
]
l
.
sort
()
print
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