From: Stefan Behnel Date: Thu, 25 Nov 2010 18:16:04 +0000 (+0100) Subject: extended test cases for scoped genexprs at module level X-Git-Tag: 0.14.alpha0~82 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c758cc3760bab40093aada6585ee077750326c90;p=cython.git extended test cases for scoped genexprs at module level --- diff --git a/tests/run/cython3.pyx b/tests/run/cython3.pyx index 213b4a81..0d10bdbd 100644 --- a/tests/run/cython3.pyx +++ b/tests/run/cython3.pyx @@ -76,6 +76,26 @@ def list_comp(): assert x == 'abc' # don't leak in Py3 code return result +module_level_lc = [ module_level_loopvar*2 for module_level_loopvar in range(4) ] +def list_comp_module_level(): + """ + >>> module_level_lc + [0, 2, 4, 6] + >>> module_level_loopvar + Traceback (most recent call last): + NameError: name 'module_level_loopvar' is not defined + """ + +module_level_list_genexp = list(module_level_genexp_loopvar*2 for module_level_genexp_loopvar in range(4)) +def genexpr_module_level(): + """ + >>> module_level_list_genexp + [0, 2, 4, 6] + >>> module_level_genexp_loopvar + Traceback (most recent call last): + NameError: name 'module_level_genexp_loopvar' is not defined + """ + def list_comp_unknown_type(l): """ >>> list_comp_unknown_type(range(5))