+cimport cython
+
+@cython.test_assert_path_exists('//ForFromStatNode',
+ "//InlinedGeneratorExpressionNode")
+@cython.test_fail_if_path_exists('//SimpleCallNode',
+ '//ForInStatNode')
def range_sum(int N):
"""
>>> sum(range(10))
result = sum(i for i in range(N))
return result
+@cython.test_assert_path_exists('//ForFromStatNode',
+ "//InlinedGeneratorExpressionNode")
+@cython.test_fail_if_path_exists('//SimpleCallNode',
+ '//ForInStatNode')
def return_range_sum(int N):
"""
>>> sum(range(10))
"""
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):
"""
>>> sum([i*i for i in range(10)])
"""
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):
"""
>>> sum([i*i for i in range(10)])
"""
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):
"""
>>> sum([i*i for i in range(10)], -1)