Commit 1a6d5069 authored by Stefan Behnel's avatar Stefan Behnel

extended test case

parent fa3273c4
......@@ -147,3 +147,35 @@ def return_typed_sum_squares_start(seq, int start):
"""
cdef int i
return <int>sum((i*i for i in seq), start)
@cython.test_assert_path_exists(
'//ForInStatNode',
"//InlinedGeneratorExpressionNode")
@cython.test_fail_if_path_exists(
'//SimpleCallNode',
"//InlinedGeneratorExpressionNode//CoerceToPyTypeNode")
def return_typed_sum_cond_exp(seq):
"""
>>> return_typed_sum_cond_exp([1,2,3,4])
2
"""
cdef int i
return <int>sum( 0 if i%2 else 1
for i in seq )
@cython.test_assert_path_exists(
'//ForInStatNode',
"//InlinedGeneratorExpressionNode")
@cython.test_fail_if_path_exists(
'//SimpleCallNode',
"//InlinedGeneratorExpressionNode//CoerceToPyTypeNode")
def return_typed_sum_cond_exp_in(seq):
"""
>>> return_typed_sum_cond_exp_in([1,2,3,4,5,6,7,8,9])
3
"""
cdef int i
return <int>sum( 0 if i%3 in (0,1) else 1
for i in seq )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment