From c758cc3760bab40093aada6585ee077750326c90 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 25 Nov 2010 19:16:04 +0100 Subject: [PATCH] extended test cases for scoped genexprs at module level --- tests/run/cython3.pyx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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)) -- 2.26.2