diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-01-19 00:09:57 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-01-19 00:09:57 (GMT) |
commit | 577473fe687b38c8f01b0c372d6d2563680045b3 (patch) | |
tree | ee7dc210c7c5281cf07add09a9cb451758e91716 /Lib/test/test_dict.py | |
parent | a69ba65fdce3be6f55634b47cc56cf1f962f6cbc (diff) | |
download | cpython-577473fe687b38c8f01b0c372d6d2563680045b3.zip cpython-577473fe687b38c8f01b0c372d6d2563680045b3.tar.gz cpython-577473fe687b38c8f01b0c372d6d2563680045b3.tar.bz2 |
use assert[Not]In where appropriate
A patch from Dave Malcolm.
Diffstat (limited to 'Lib/test/test_dict.py')
-rw-r--r-- | Lib/test/test_dict.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index 8984334..919fce8 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -35,7 +35,9 @@ class DictTest(unittest.TestCase): d = {'a': 1, 'b': 2} k = d.keys() self.assertTrue('a' in d) + self.assertIn('a', d) self.assertTrue('b' in d) + self.assertIn('b', d) self.assertRaises(TypeError, d.keys, None) self.assertEqual(repr(dict(a=1).keys()), "dict_keys(['a'])") @@ -60,10 +62,14 @@ class DictTest(unittest.TestCase): d = {} self.assertTrue(not ('a' in d)) self.assertTrue('a' not in d) + self.assertNotIn('a', d) d = {'a': 1, 'b': 2} self.assertTrue('a' in d) + self.assertIn('a', d) self.assertTrue('b' in d) + self.assertIn('b', d) self.assertTrue('c' not in d) + self.assertNotIn('c', d) self.assertRaises(TypeError, d.__contains__) @@ -519,7 +525,9 @@ class DictTest(unittest.TestCase): self.assertEqual(d[1], 2) self.assertEqual(d[3], 4) self.assertTrue(2 not in d) + self.assertNotIn(2, d) self.assertTrue(2 not in d.keys()) + self.assertNotIn(2, d.keys()) self.assertEqual(d[2], 42) class E(dict): def __missing__(self, key): |