From: Stefan Behnel Date: Thu, 27 May 2010 10:57:22 +0000 (+0200) Subject: extended test case X-Git-Tag: 0.13.beta0~2^2~37 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ac7b0df6c61eee24088a3bee62cf6908d1ce8d08;p=cython.git extended test case --- diff --git a/tests/run/inlined_generator_expressions.pyx b/tests/run/inlined_generator_expressions.pyx index 0787c2eb..9e516531 100644 --- a/tests/run/inlined_generator_expressions.pyx +++ b/tests/run/inlined_generator_expressions.pyx @@ -18,6 +18,7 @@ def range_sum(int N): @cython.test_assert_path_exists('//ForFromStatNode', "//InlinedGeneratorExpressionNode") @cython.test_fail_if_path_exists('//SimpleCallNode', + '//CoerceFromPyTypeNode//InlinedGeneratorExpressionNode', '//ForInStatNode') def range_sum_typed(int N): """ @@ -29,6 +30,23 @@ def range_sum_typed(int N): cdef int result = sum(i for i in range(N)) return result +@cython.test_assert_path_exists('//ForFromStatNode', + "//InlinedGeneratorExpressionNode", + "//ReturnStatNode//InlinedGeneratorExpressionNode", + "//ReturnStatNode//CoerceToPyTypeNode//InlinedGeneratorExpressionNode") +@cython.test_fail_if_path_exists('//SimpleCallNode', + '//CoerceFromPyTypeNode//InlinedGeneratorExpressionNode', + '//TypecastNode//InlinedGeneratorExpressionNode', + '//ForInStatNode') +def return_range_sum_cast(int N): + """ + >>> sum(range(10)) + 45 + >>> return_range_sum_cast(10) + 45 + """ + return sum(i for i in range(N)) + @cython.test_assert_path_exists('//ForFromStatNode', "//InlinedGeneratorExpressionNode") @cython.test_fail_if_path_exists('//SimpleCallNode',