summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_dict.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-01-08 19:04:16 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-01-08 19:04:16 (GMT)
commitce8e33a095030e7af94f58f9da196b240bdf0476 (patch)
treeb0ba50cbb6e85c6be6f6e6a870e4232be50a0f9c /Lib/test/test_dict.py
parent3ddc435af6873c6304058d7bcbcb19ee4fba7781 (diff)
downloadcpython-ce8e33a095030e7af94f58f9da196b240bdf0476.zip
cpython-ce8e33a095030e7af94f58f9da196b240bdf0476.tar.gz
cpython-ce8e33a095030e7af94f58f9da196b240bdf0476.tar.bz2
Reverting the Revision: 77368. I committed Flox's big patch for tests by
mistake. ( It may come in for sure tough)
Diffstat (limited to 'Lib/test/test_dict.py')
-rw-r--r--Lib/test/test_dict.py42
1 files changed, 15 insertions, 27 deletions
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
index de400aa..075f9dc 100644
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -33,12 +33,8 @@ class DictTest(unittest.TestCase):
self.assertEqual(d.keys(), [])
d = {'a': 1, 'b': 2}
k = d.keys()
- self.assertTrue('a' in d)
- self.assertTrue('b' in d)
- # Silence Py3k warning
- with test_support.check_warnings():
- self.assertTrue(d.has_key('a'))
- self.assertTrue(d.has_key('b'))
+ self.assertTrue(d.has_key('a'))
+ self.assertTrue(d.has_key('b'))
self.assertRaises(TypeError, d.keys, None)
@@ -61,16 +57,14 @@ class DictTest(unittest.TestCase):
def test_has_key(self):
d = {}
- self.assertTrue('a' not in d)
- # Silence Py3k warning
- with test_support.check_warnings():
- self.assertTrue(not d.has_key('a'))
- self.assertRaises(TypeError, d.has_key)
+ self.assertTrue(not d.has_key('a'))
d = {'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.assertTrue(not ('a' in d))
@@ -401,6 +395,8 @@ class DictTest(unittest.TestCase):
self.assertRaises(Exc, repr, d)
def test_le(self):
+ self.assertTrue(not ({} < {}))
+ self.assertTrue(not ({1: 2} < {1L: 2L}))
class Exc(Exception): pass
@@ -412,18 +408,12 @@ class DictTest(unittest.TestCase):
d1 = {BadCmp(): 1}
d2 = {1: 1}
-
- # Silence Py3k warning
- with test_support.check_warnings():
- self.assertTrue(not ({} < {}))
- self.assertTrue(not ({1: 2} < {1L: 2L}))
-
- try:
- d1 < d2
- except Exc:
- pass
- else:
- self.fail("< didn't raise Exc")
+ try:
+ d1 < d2
+ except Exc:
+ pass
+ else:
+ self.fail("< didn't raise Exc")
def test_missing(self):
# Make sure dict doesn't have a __missing__ method
@@ -511,9 +501,7 @@ class DictTest(unittest.TestCase):
'd.pop(x2)',
'd.update({x2: 2})']:
try:
- # Silence Py3k warning
- with test_support.check_warnings():
- exec stmt in locals()
+ exec stmt in locals()
except CustomException:
pass
else:
@@ -561,7 +549,7 @@ class DictTest(unittest.TestCase):
# Bug #3537: if an empty but presized dict with a size larger
# than 7 was in the freelist, it triggered an assertion failure
try:
- d = {'a': 1 // 0, 'b': None, 'c': None, 'd': None, 'e': None,
+ d = {'a': 1/0, 'b': None, 'c': None, 'd': None, 'e': None,
'f': None, 'g': None, 'h': None}
except ZeroDivisionError:
pass