diff options
Diffstat (limited to 'tests/run/for_in_iter.py')
-rw-r--r-- | tests/run/for_in_iter.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/run/for_in_iter.py b/tests/run/for_in_iter.py index f41ed18d2..1b86de2a3 100644 --- a/tests/run/for_in_iter.py +++ b/tests/run/for_in_iter.py @@ -61,6 +61,37 @@ def for_in_literal_mult_list(): l.append(i) return l + +def listcomp_over_multiplied_constant_tuple(): + """ + >>> listcomp_over_multiplied_constant_tuple() + [[], [1, 2, 3], [1, 2, 3, 1, 2, 3], [1, 2, 3, 1, 2, 3, 1, 2, 3], [1, 2, 3, 1, 2, 3]] + """ + return [ + [i for i in (1, 2, 3) * 0], + [i for i in (1, 2, 3) * 1], + [i for i in (1, 2, 3) * 2], + [i for i in (1, 2, 3) * 3], + [i for i in (1, 2, 3) * 2], + ] + + +@cython.test_assert_path_exists('//ReturnStatNode//ForInStatNode//TupleNode') +@cython.test_fail_if_path_exists('//ReturnStatNode//ForInStatNode//ListNode') +def listcomp_over_multiplied_constant_list(): + """ + >>> listcomp_over_multiplied_constant_list() + [[], [1, 2, 3], [1, 2, 3, 1, 2, 3], [1, 2, 3, 1, 2, 3, 1, 2, 3], [1, 2, 3, 1, 2, 3]] + """ + return [ + [i for i in [1, 2, 3] * 0], + [i for i in [1, 2, 3] * 1], + [i for i in [1, 2, 3] * 2], + [i for i in [1, 2, 3] * 3], + [i for i in [1, 2, 3] * 2], + ] + + class Iterable(object): """ >>> for_in_pyiter(Iterable(5)) |