extended test case
authorStefan Behnel <scoder@users.berlios.de>
Thu, 27 May 2010 16:45:25 +0000 (18:45 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 27 May 2010 16:45:25 +0000 (18:45 +0200)
tests/run/inlined_generator_expressions.pyx

index 3fd1bbde9daf9b0867474e4d9bd86ca3571f9c9b..9bc9430c7ff8bb93e391732189591e9736c742aa 100644 (file)
@@ -125,3 +125,25 @@ def return_sum_squares_start(seq, int start):
     333283335009
     """
     return 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_squares_start(seq, int start):
+    """
+    >>> sum([i*i for i in range(10)], -1)
+    284
+    >>> return_typed_sum_squares_start(range(10), -1)
+    284
+
+    >>> sum([i*i for i in range(10000)], 9)
+    333283335009
+    >>> return_typed_sum_squares_start(range(10000), 9)
+    333283335009
+    """
+    cdef int i
+    return <long>sum((i*i for i in seq), start)