summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_builtin.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-02-11 06:12:03 (GMT)
committerGuido van Rossum <guido@python.org>2007-02-11 06:12:03 (GMT)
commitcc2b0161257495f859200bce0aea3ed7e646feb3 (patch)
treeba09aba0de6447bef5be59b43fb86d17d760833d /Lib/test/test_builtin.py
parent4e66dfcdc495218ad5f98b12ad6b4b2b05630ab0 (diff)
downloadcpython-cc2b0161257495f859200bce0aea3ed7e646feb3.zip
cpython-cc2b0161257495f859200bce0aea3ed7e646feb3.tar.gz
cpython-cc2b0161257495f859200bce0aea3ed7e646feb3.tar.bz2
- PEP 3106: dict.iterkeys(), .iteritems(), .itervalues() are now gone;
and .keys(), .items(), .values() return dict views. The dict views aren't fully functional yet; in particular, they can't be compared to sets yet. but they are useful as "iterator wells". There are still 27 failing unit tests; I expect that many of these have fairly trivial fixes, but there are so many, I could use help.
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r--Lib/test/test_builtin.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index ab9dfc8..b6ac990 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -290,8 +290,8 @@ class BuiltinTest(unittest.TestCase):
if key == 'a':
return 12
raise KeyError
- def keys(self):
- return list('xyz')
+ def __iter__(self):
+ return iter('xyz')
m = M()
g = globals()
@@ -313,8 +313,8 @@ class BuiltinTest(unittest.TestCase):
if key == 'a':
return 12
return dict.__getitem__(self, key)
- def keys(self):
- return list('xyz')
+ def __iter__(self):
+ return iter('xyz')
d = D()
self.assertEqual(eval('a', g, d), 12)
@@ -346,8 +346,8 @@ class BuiltinTest(unittest.TestCase):
class C:
def __getitem__(self, item):
raise KeyError(item)
- def keys(self):
- return 'a'
+ def __iter__(self):
+ return 'a' # XXX Not quite faithful to the SF bug...
self.assertRaises(TypeError, eval, 'dir()', globals(), C())
# Done outside of the method test_z to get the correct scope
@@ -522,8 +522,8 @@ class BuiltinTest(unittest.TestCase):
unicode("123"): unicode("112233")
}
- for (cls, inps) in inputs.iteritems():
- for (inp, exp) in inps.iteritems():
+ for (cls, inps) in inputs.items():
+ for (inp, exp) in inps.items():
# make sure the output goes through __getitem__
# even if func is None
self.assertEqual(