From: Raymond Hettinger Date: Thu, 20 May 2004 23:04:13 +0000 (+0000) Subject: Add a test to verify an early call to iter() on the outermost for X-Git-Tag: v2.4a1~352 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=83ee79524ae6462b7b044bb9cf2f625231814dba;p=python Add a test to verify an early call to iter() on the outermost for expression. --- diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py index b09fc952bf..31e133fe75 100644 --- a/Lib/test/test_genexps.py +++ b/Lib/test/test_genexps.py @@ -91,6 +91,15 @@ Verify early binding for the outermost for-expression >>> list(g) [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] +Verify that the outermost for-expression makes an immediate check +for iterability + + >>> (i for i in 6) + Traceback (most recent call last): + File "", line 1, in -toplevel- + (i for i in 6) + TypeError: iteration over non-sequence + Verify late binding for the outermost if-expression >>> include = (2,4,6,8)