diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-08-27 15:12:49 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-08-27 15:12:49 (GMT) |
commit | aef8cfaa287304aa7827e591d9b19e8dd308fe40 (patch) | |
tree | c0d35202ea624bb6baaad18c4b5be53bee3a2df9 /Lib/test/test_generators.py | |
parent | 0fafacc6722ee9e34cfba4484095e08576945270 (diff) | |
download | cpython-aef8cfaa287304aa7827e591d9b19e8dd308fe40.zip cpython-aef8cfaa287304aa7827e591d9b19e8dd308fe40.tar.gz cpython-aef8cfaa287304aa7827e591d9b19e8dd308fe40.tar.bz2 |
Don't really need ellipsis doctests for the syntax errors, because
this module imports itself explicitly from test (so the "file names"
current doctest synthesizes for examples don't vary depending on how
test_generators is run).
Diffstat (limited to 'Lib/test/test_generators.py')
-rw-r--r-- | Lib/test/test_generators.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index 5a7cd1d..0c44634 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -649,28 +649,28 @@ Ye olde Fibonacci generator, LazyList style. syntax_tests = """ ->>> def f(): #doctest: +ELLIPSIS +>>> def f(): ... return 22 ... yield 1 Traceback (most recent call last): .. -SyntaxError: 'return' with argument inside generator (..., line 2) +SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.syntax[0]>, line 2) ->>> def f(): #doctest: +ELLIPSIS +>>> def f(): ... yield 1 ... return 22 Traceback (most recent call last): .. -SyntaxError: 'return' with argument inside generator (..., line 3) +SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.syntax[1]>, line 3) "return None" is not the same as "return" in a generator: ->>> def f(): #doctest: +ELLIPSIS +>>> def f(): ... yield 1 ... return None Traceback (most recent call last): .. -SyntaxError: 'return' with argument inside generator (..., line 3) +SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.syntax[2]>, line 3) This one is fine: @@ -678,16 +678,16 @@ This one is fine: ... yield 1 ... return ->>> def f(): #doctest: +ELLIPSIS +>>> def f(): ... try: ... yield 1 ... finally: ... pass Traceback (most recent call last): .. -SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause (..., line 3) +SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause (<doctest test.test_generators.syntax[4]>, line 3) ->>> def f(): #doctest: +ELLIPSIS +>>> def f(): ... try: ... try: ... 1//0 @@ -699,7 +699,7 @@ SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause (..., ... pass Traceback (most recent call last): ... -SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause (..., line 6) +SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause (<doctest test.test_generators.syntax[5]>, line 6) But this is fine: @@ -794,7 +794,7 @@ SyntaxError: invalid syntax <type 'generator'> ->>> def f(): #doctest: +ELLIPSIS +>>> def f(): ... if 0: ... lambda x: x # shouldn't trigger here ... return # or here @@ -805,7 +805,7 @@ SyntaxError: invalid syntax ... if 0: ... yield 2 # because it's a generator Traceback (most recent call last): -SyntaxError: 'return' with argument inside generator (..., line 8) +SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.syntax[22]>, line 8) This one caused a crash (see SF bug 567538): |