summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_generators.py
diff options
context:
space:
mode:
authorKushal Das <kushaldas@gmail.com>2016-06-04 23:21:13 (GMT)
committerKushal Das <kushaldas@gmail.com>2016-06-04 23:21:13 (GMT)
commit5801ecb4408cd11f6e6ffcb1612ca68d9936a728 (patch)
treed50a9aa79b55eb92dde2c12908d6ecb14fc7f1d5 /Lib/test/test_generators.py
parent409482251b06fe75c4ee56e85ffbb4b23d934159 (diff)
downloadcpython-5801ecb4408cd11f6e6ffcb1612ca68d9936a728.zip
cpython-5801ecb4408cd11f6e6ffcb1612ca68d9936a728.tar.gz
cpython-5801ecb4408cd11f6e6ffcb1612ca68d9936a728.tar.bz2
Issue #25548: Showing memory address of class objects in repl
Diffstat (limited to 'Lib/test/test_generators.py')
-rw-r--r--Lib/test/test_generators.py37
1 files changed, 19 insertions, 18 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index f4b33af..c193301 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,8 +2174,9 @@ __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)
+ support.run_doctest(test_generators, verbose, optionflags=doctest.ELLIPSIS)
# This part isn't needed for regrtest, but for running the test directly.
if __name__ == "__main__":