Commit b6ad71a2 authored by Stefan Behnel's avatar Stefan Behnel

test for generator expressions (disabled)

parent 24c64823
......@@ -9,6 +9,7 @@ missing_baseclass_in_predecl_T262
cfunc_call_tuple_args_T408
cascaded_list_unpacking_T467
compile.cpp_operators
genexpr_T491
# CPython regression tests that don't current work:
pyregr.test_threadsignals
......
def test_genexpr():
"""
>>> gen = test_genexpr()
>>> list(gen)
[0, 1, 2, 3, 4]
"""
return (i for i in range(5))
def test_genexpr_typed():
"""
>>> gen = test_genexpr_typed()
>>> list(gen)
[0, 1, 2, 3, 4]
"""
cdef int i
return (i for i in range(5))
def test_genexpr_funccall():
"""
>>> test_genexpr_funccall()
[0, 1, 2, 3, 4]
"""
return list(i for i in range(5))
def test_genexpr_scope():
"""
>>> test_genexpr_scope()
([0, 1, 2, 3, 4], 'abc')
"""
i = 'abc'
gen = (i for i in range(5))
lst = list(gen)
return lst, i
def test_genexpr_closure():
"""
>>> gen = test_genexpr_closure()
>>> list(gen)
['a', 'b', 'c']
"""
abc = 'a' + 'b' + 'c'
return (c for c in abc)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment