diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-07-14 04:13:29 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-07-14 04:13:29 (GMT) |
commit | ab078e9ed1a5d1b693d6ee843f1a34e8993e9dee (patch) | |
tree | 55e6e21b81315f126e76357af7e545cfe498d778 /Lib/test/test_generators.py | |
parent | fb4f8257bfa4471764e10c1d8525a5bb7b0145e5 (diff) | |
download | cpython-ab078e9ed1a5d1b693d6ee843f1a34e8993e9dee.zip cpython-ab078e9ed1a5d1b693d6ee843f1a34e8993e9dee.tar.gz cpython-ab078e9ed1a5d1b693d6ee843f1a34e8993e9dee.tar.bz2 |
Backed out changeset af29d89083b3 (closes #25548) (closes #27498)
Diffstat (limited to 'Lib/test/test_generators.py')
-rw-r--r-- | Lib/test/test_generators.py | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index c193301..f4b33af 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -671,10 +671,10 @@ From the Iterators list, about the types of these things. ... yield 1 ... >>> type(g) -<class 'function' ...> +<class 'function'> >>> i = g() >>> type(i) -<class 'generator' ...> +<class 'generator'> >>> [s for s in dir(i) if not s.startswith('_')] ['close', 'gi_code', 'gi_frame', 'gi_running', 'gi_yieldfrom', 'send', 'throw'] >>> from test.support import HAVE_DOCSTRINGS @@ -691,7 +691,7 @@ And more, added later. >>> i.gi_running 0 >>> type(i.gi_frame) -<class 'frame' ...> +<class 'frame'> >>> i.gi_running = 42 Traceback (most recent call last): ... @@ -1066,27 +1066,27 @@ These are fine: >>> def f(): ... yield >>> type(f()) -<class 'generator' ...> +<class 'generator'> >>> def f(): ... if 0: ... yield >>> type(f()) -<class 'generator' ...> +<class 'generator'> >>> def f(): ... if 0: ... yield 1 >>> type(f()) -<class 'generator' ...> +<class 'generator'> >>> def f(): ... if "": ... yield None >>> type(f()) -<class 'generator' ...> +<class 'generator'> >>> def f(): ... return @@ -1110,7 +1110,7 @@ These are fine: ... x = 1 ... return >>> type(f()) -<class 'generator' ...> +<class 'generator'> >>> def f(): ... if 0: @@ -1118,7 +1118,7 @@ These are fine: ... yield 1 ... >>> type(f()) -<class 'NoneType' ...> +<class 'NoneType'> >>> def f(): ... if 0: @@ -1128,7 +1128,7 @@ These are fine: ... def f(self): ... yield 2 >>> type(f()) -<class 'NoneType' ...> +<class 'NoneType'> >>> def f(): ... if 0: @@ -1136,7 +1136,7 @@ These are fine: ... if 0: ... yield 2 >>> type(f()) -<class 'generator' ...> +<class 'generator'> This one caused a crash (see SF bug 567538): @@ -1791,7 +1791,7 @@ And a more sane, but still weird usage: >>> def f(): list(i for i in [(yield 26)]) >>> type(f()) -<class 'generator' ...> +<class 'generator'> A yield expression with augmented assignment. @@ -2047,25 +2047,25 @@ enclosing function a generator: >>> def f(): x += yield >>> type(f()) -<class 'generator' ...> +<class 'generator'> >>> def f(): x = yield >>> type(f()) -<class 'generator' ...> +<class 'generator'> >>> def f(): lambda x=(yield): 1 >>> type(f()) -<class 'generator' ...> +<class 'generator'> >>> def f(): x=(i for i in (yield) if (yield)) >>> type(f()) -<class 'generator' ...> +<class 'generator'> >>> def f(d): d[(yield "a")] = d[(yield "b")] = 27 >>> data = [1,2] >>> g = f(data) >>> type(g) -<class 'generator' ...> +<class 'generator'> >>> g.send(None) 'a' >>> data @@ -2174,9 +2174,8 @@ __test__ = {"tut": tutorial_tests, # so this works as expected in both ways of running regrtest. def test_main(verbose=None): from test import support, test_generators - import doctest support.run_unittest(__name__) - support.run_doctest(test_generators, verbose, optionflags=doctest.ELLIPSIS) + support.run_doctest(test_generators, verbose) # This part isn't needed for regrtest, but for running the test directly. if __name__ == "__main__": |