From: Robert Bradshaw Date: Thu, 27 Jan 2011 22:01:47 +0000 (-0800) Subject: Nested generator test. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d5c80a3da7c144da2519a019eac788fd09158cdd;p=cython.git Nested generator test. --- diff --git a/tests/run/generators.pyx b/tests/run/generators.pyx index af8926c8..0060eba3 100644 --- a/tests/run/generators.pyx +++ b/tests/run/generators.pyx @@ -299,3 +299,11 @@ def test_inside_lambda(): ('a', 'b') """ return lambda:((yield 1), (yield 2)) + +def test_nested_gen(int n): + """ + >>> [list(a) for a in test_nested_gen(5)] + [[], [0], [0, 1], [0, 1, 2], [0, 1, 2, 3]] + """ + for a in range(n): + yield (b for b in range(a))