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
a2e62213
Commit
a2e62213
authored
May 26, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extended test case
parent
371b92f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
tests/run/inlined_generator_expressions.pyx
tests/run/inlined_generator_expressions.pyx
+20
-0
No files found.
tests/run/inlined_generator_expressions.pyx
View file @
a2e62213
cimport
cython
@
cython
.
test_assert_path_exists
(
'//ForFromStatNode'
,
"//InlinedGeneratorExpressionNode"
)
@
cython
.
test_fail_if_path_exists
(
'//SimpleCallNode'
,
'//ForInStatNode'
)
def
range_sum
(
int
N
):
def
range_sum
(
int
N
):
"""
"""
>>> sum(range(10))
>>> sum(range(10))
...
@@ -9,6 +15,10 @@ def range_sum(int N):
...
@@ -9,6 +15,10 @@ def range_sum(int N):
result
=
sum
(
i
for
i
in
range
(
N
))
result
=
sum
(
i
for
i
in
range
(
N
))
return
result
return
result
@
cython
.
test_assert_path_exists
(
'//ForFromStatNode'
,
"//InlinedGeneratorExpressionNode"
)
@
cython
.
test_fail_if_path_exists
(
'//SimpleCallNode'
,
'//ForInStatNode'
)
def
return_range_sum
(
int
N
):
def
return_range_sum
(
int
N
):
"""
"""
>>> sum(range(10))
>>> sum(range(10))
...
@@ -18,6 +28,10 @@ def return_range_sum(int N):
...
@@ -18,6 +28,10 @@ def return_range_sum(int N):
"""
"""
return
sum
(
i
for
i
in
range
(
N
))
return
sum
(
i
for
i
in
range
(
N
))
@
cython
.
test_assert_path_exists
(
'//ForFromStatNode'
,
"//InlinedGeneratorExpressionNode"
)
@
cython
.
test_fail_if_path_exists
(
'//SimpleCallNode'
,
'//ForInStatNode'
)
def
return_range_sum_squares
(
int
N
):
def
return_range_sum_squares
(
int
N
):
"""
"""
>>> sum([i*i for i in range(10)])
>>> sum([i*i for i in range(10)])
...
@@ -32,6 +46,9 @@ def return_range_sum_squares(int N):
...
@@ -32,6 +46,9 @@ def return_range_sum_squares(int N):
"""
"""
return
sum
(
i
*
i
for
i
in
range
(
N
))
return
sum
(
i
*
i
for
i
in
range
(
N
))
@
cython
.
test_assert_path_exists
(
'//ForInStatNode'
,
"//InlinedGeneratorExpressionNode"
)
@
cython
.
test_fail_if_path_exists
(
'//SimpleCallNode'
)
def
return_sum_squares
(
seq
):
def
return_sum_squares
(
seq
):
"""
"""
>>> sum([i*i for i in range(10)])
>>> sum([i*i for i in range(10)])
...
@@ -46,6 +63,9 @@ def return_sum_squares(seq):
...
@@ -46,6 +63,9 @@ def return_sum_squares(seq):
"""
"""
return
sum
(
i
*
i
for
i
in
seq
)
return
sum
(
i
*
i
for
i
in
seq
)
@
cython
.
test_assert_path_exists
(
'//ForInStatNode'
,
"//InlinedGeneratorExpressionNode"
)
@
cython
.
test_fail_if_path_exists
(
'//SimpleCallNode'
)
def
return_sum_squares_start
(
seq
,
int
start
):
def
return_sum_squares_start
(
seq
,
int
start
):
"""
"""
>>> sum([i*i for i in range(10)], -1)
>>> sum([i*i for i in range(10)], -1)
...
...
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