summaryrefslogtreecommitdiff
path: root/Lib/test/mapping_tests.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-08-18 22:13:04 +0000
committerGuido van Rossum <guido@python.org>2006-08-18 22:13:04 +0000
commite2b70bcf7401477936fba99a8bf4a1f759ecc8a3 (patch)
tree4c9b65b7fd8c26a3d2f1b64ecd6b4c72a756b4b2 /Lib/test/mapping_tests.py
parentd2dbecb4ae9177e2e87adcb047147c6bcbf28cc1 (diff)
downloadcpython-git-e2b70bcf7401477936fba99a8bf4a1f759ecc8a3.tar.gz
Get rid of dict.has_key(). Boy this has a lot of repercussions!
Not all code has been fixed yet; this is just a checkpoint... The C API still has PyDict_HasKey() and _HasKeyString(); not sure if I want to change those just yet.
Diffstat (limited to 'Lib/test/mapping_tests.py')
-rw-r--r--Lib/test/mapping_tests.py14
1 files changed, 1 insertions, 13 deletions
diff --git a/Lib/test/mapping_tests.py b/Lib/test/mapping_tests.py
index 4b0f797fbf..1c570b6d34 100644
--- a/Lib/test/mapping_tests.py
+++ b/Lib/test/mapping_tests.py
@@ -54,12 +54,10 @@ class BasicTestMappingProtocol(unittest.TestCase):
#len
self.assertEqual(len(p), 0)
self.assertEqual(len(d), len(self.reference))
- #has_key
+ #__contains__
for k in self.reference:
- self.assert_(d.has_key(k))
self.assert_(k in d)
for k in self.other:
- self.failIf(d.has_key(k))
self.failIf(k in d)
#cmp
self.assertEqual(cmp(p,p), 0)
@@ -333,16 +331,6 @@ class TestMappingProtocol(BasicTestMappingProtocol):
d = self._full_mapping({1:2})
self.assertEqual(d.items(), [(1, 2)])
- def test_has_key(self):
- d = self._empty_mapping()
- self.assert_(not d.has_key('a'))
- d = self._full_mapping({'a': 1, 'b': 2})
- k = d.keys()
- k.sort()
- self.assertEqual(k, ['a', 'b'])
-
- self.assertRaises(TypeError, d.has_key)
-
def test_contains(self):
d = self._empty_mapping()
self.assert_(not ('a' in d))