summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-15 15:08:32 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-15 15:08:32 (GMT)
commitc91210c06b6ba5126879b34692ef6291252f68ad (patch)
tree1eaec7063d23eede19190ce6fa1bb3cce9fd9677 /Lib/test
parentb346513044e265accd338c136d5b4bbbe88a8979 (diff)
downloadcpython-c91210c06b6ba5126879b34692ef6291252f68ad.zip
cpython-c91210c06b6ba5126879b34692ef6291252f68ad.tar.gz
cpython-c91210c06b6ba5126879b34692ef6291252f68ad.tar.bz2
#2863: add gen.__name__ and add this name to generator repr().
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_generators.py11
-rw-r--r--Lib/test/test_genexps.py2
2 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index ab0fca0..7be0a90 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -917,6 +917,17 @@ StopIteration
>>> g.gi_code is f.func_code
True
+
+Test the __name__ attribute and the repr()
+
+>>> def f():
+... yield 5
+...
+>>> g = f()
+>>> g.__name__
+'f'
+>>> repr(g) # doctest: +ELLIPSIS
+'<f generator object at ...>'
"""
# conjoin is a simple backtracking generator, named in honor of Icon's
diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py
index 2598a79..0317955 100644
--- a/Lib/test/test_genexps.py
+++ b/Lib/test/test_genexps.py
@@ -92,7 +92,7 @@ Verify that parenthesis are required when used as a keyword argument value
Verify that parenthesis are required when used as a keyword argument value
>>> dict(a = (i for i in xrange(10))) #doctest: +ELLIPSIS
- {'a': <generator object at ...>}
+ {'a': <<genexp> generator object at ...>}
Verify early binding for the outermost for-expression