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_iter.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_iter.py')
-rw-r--r-- | Lib/test/test_iter.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/test/test_iter.py b/Lib/test/test_iter.py index a826598..3642c44 100644 --- a/Lib/test/test_iter.py +++ b/Lib/test/test_iter.py @@ -542,23 +542,23 @@ class TestCase(unittest.TestCase): def test_in_and_not_in(self): for sc5 in IteratingSequenceClass(5), SequenceClass(5): for i in range(5): - self.assertTrue(i in sc5) + self.assertIn(i, sc5) for i in "abc", -1, 5, 42.42, (3, 4), [], {1: 1}, 3-12j, sc5: - self.assertTrue(i not in sc5) + self.assertNotIn(i, sc5) self.assertRaises(TypeError, lambda: 3 in 12) self.assertRaises(TypeError, lambda: 3 not in map) d = {"one": 1, "two": 2, "three": 3, 1j: 2j} for k in d: - self.assertTrue(k in d) - self.assertTrue(k not in d.values()) + self.assertIn(k, d) + self.assertNotIn(k, d.values()) for v in d.values(): - self.assertTrue(v in d.values()) - self.assertTrue(v not in d) + self.assertIn(v, d.values()) + self.assertNotIn(v, d) for k, v in d.items(): - self.assertTrue((k, v) in d.items()) - self.assertTrue((v, k) not in d.items()) + self.assertIn((k, v), d.items()) + self.assertNotIn((v, k), d.items()) f = open(TESTFN, "w") try: @@ -569,9 +569,9 @@ class TestCase(unittest.TestCase): try: for chunk in "abc": f.seek(0, 0) - self.assertTrue(chunk not in f) + self.assertNotIn(chunk, f) f.seek(0, 0) - self.assertTrue((chunk + "\n") in f) + self.assertIn((chunk + "\n"), f) finally: f.close() try: |