From ac7b0df6c61eee24088a3bee62cf6908d1ce8d08 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 27 May 2010 12:57:22 +0200 Subject: [PATCH] extended test case --- tests/run/inlined_generator_expressions.pyx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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', -- 2.26.2