summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2002-03-25 18:36:32 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2002-03-25 18:36:32 (GMT)
commitdbd2d2560c5cb131f449039cf6d5928ae0c63051 (patch)
tree1cbeac6a561e15788d43e67f159eb3c0ceac42e5
parente990c79fa843309f619819d6aa4bc34353282545 (diff)
downloadcpython-dbd2d2560c5cb131f449039cf6d5928ae0c63051.zip
cpython-dbd2d2560c5cb131f449039cf6d5928ae0c63051.tar.gz
cpython-dbd2d2560c5cb131f449039cf6d5928ae0c63051.tar.bz2
Add tests for the iterkeys, itervalues and iteritems
methods in dict-proxy objects.
-rw-r--r--Lib/test/test_descr.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index ce28cce..830cd08 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -2835,6 +2835,32 @@ def modules():
m.foo = 1
vereq(m.__dict__, {"foo": 1})
+def dictproxyiterkeys():
+ class C(object):
+ def meth(self):
+ pass
+ if verbose: print "Testing dict-proxy iterkeys..."
+ keys = [ key for key in C.__dict__.iterkeys() ]
+ keys.sort()
+ vereq(keys, ['__dict__', '__doc__', '__module__', '__weakref__', 'meth'])
+
+def dictproxyitervalues():
+ class C(object):
+ def meth(self):
+ pass
+ if verbose: print "Testing dict-proxy itervalues..."
+ values = [ values for values in C.__dict__.itervalues() ]
+ vereq(len(values), 5)
+
+def dictproxyiteritems():
+ class C(object):
+ def meth(self):
+ pass
+ if verbose: print "Testing dict-proxy iteritems..."
+ keys = [ key for (key, value) in C.__dict__.iteritems() ]
+ keys.sort()
+ vereq(keys, ['__dict__', '__doc__', '__module__', '__weakref__', 'meth'])
+
def test_main():
class_docstrings()
lists()
@@ -2891,6 +2917,9 @@ def test_main():
strops()
deepcopyrecursive()
modules()
+ dictproxyiterkeys()
+ dictproxyitervalues()
+ dictproxyiteritems()
pickleslots()
if verbose: print "All OK"