extended test case
authorStefan Behnel <scoder@users.berlios.de>
Thu, 27 May 2010 10:57:22 +0000 (12:57 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 27 May 2010 10:57:22 +0000 (12:57 +0200)
tests/run/inlined_generator_expressions.pyx

index 0787c2eb950543e6e656caf1b008806c0f322819..9e516531dddbbb49bd17e81b66bfdf27550331bc 100644 (file)
@@ -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 <int>sum(i for i in range(N))
+
 @cython.test_assert_path_exists('//ForFromStatNode',
                                 "//InlinedGeneratorExpressionNode")
 @cython.test_fail_if_path_exists('//SimpleCallNode',