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.
This commit is contained in:
Guido van Rossum 2006-08-18 22:13:04 +00:00
parent d2dbecb4ae
commit e2b70bcf74
93 changed files with 215 additions and 313 deletions

View file

@ -9,39 +9,39 @@ from test import test_support
class CFunctionCalls(unittest.TestCase):
def test_varargs0(self):
self.assertRaises(TypeError, {}.has_key)
self.assertRaises(TypeError, {}.__contains__)
def test_varargs1(self):
{}.has_key(0)
{}.__contains__(0)
def test_varargs2(self):
self.assertRaises(TypeError, {}.has_key, 0, 1)
self.assertRaises(TypeError, {}.__contains__, 0, 1)
def test_varargs0_ext(self):
try:
{}.has_key(*())
{}.__contains__(*())
except TypeError:
pass
def test_varargs1_ext(self):
{}.has_key(*(0,))
{}.__contains__(*(0,))
def test_varargs2_ext(self):
try:
{}.has_key(*(1, 2))
{}.__contains__(*(1, 2))
except TypeError:
pass
else:
raise RuntimeError
def test_varargs0_kw(self):
self.assertRaises(TypeError, {}.has_key, x=2)
self.assertRaises(TypeError, {}.__contains__, x=2)
def test_varargs1_kw(self):
self.assertRaises(TypeError, {}.has_key, x=2)
self.assertRaises(TypeError, {}.__contains__, x=2)
def test_varargs2_kw(self):
self.assertRaises(TypeError, {}.has_key, x=2, y=2)
self.assertRaises(TypeError, {}.__contains__, x=2, y=2)
def test_oldargs0_0(self):
{}.keys()