diff options
Diffstat (limited to 'Lib/test/test_contains.py')
-rw-r--r-- | Lib/test/test_contains.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Lib/test/test_contains.py b/Lib/test/test_contains.py index 622dfd4..a667a16 100644 --- a/Lib/test/test_contains.py +++ b/Lib/test/test_contains.py @@ -20,19 +20,19 @@ class TestContains(unittest.TestCase): a = base_set(1) b = myset(1) c = seq(1) - self.assertTrue(1 in b) - self.assertTrue(0 not in b) - self.assertTrue(1 in c) - self.assertTrue(0 not in c) + self.assertIn(1, b) + self.assertNotIn(0, b) + self.assertIn(1, c) + self.assertNotIn(0, c) self.assertRaises(TypeError, lambda: 1 in a) self.assertRaises(TypeError, lambda: 1 not in a) # test char in string - self.assertTrue('c' in 'abc') - self.assertTrue('d' not in 'abc') + self.assertIn('c', 'abc') + self.assertNotIn('d', 'abc') - self.assertTrue('' in '') - self.assertTrue('' in 'abc') + self.assertIn('', '') + self.assertIn('', 'abc') self.assertRaises(TypeError, lambda: None in 'abc') @@ -40,15 +40,15 @@ class TestContains(unittest.TestCase): # a collection of tests on builtin sequence types a = range(10) for i in a: - self.assertTrue(i in a) - self.assertTrue(16 not in a) - self.assertTrue(a not in a) + self.assertIn(i, a) + self.assertNotIn(16, a) + self.assertNotIn(a, a) a = tuple(a) for i in a: - self.assertTrue(i in a) - self.assertTrue(16 not in a) - self.assertTrue(a not in a) + self.assertIn(i, a) + self.assertNotIn(16, a) + self.assertNotIn(a, a) class Deviant1: """Behaves strangely when compared @@ -64,7 +64,7 @@ class TestContains(unittest.TestCase): self.aList.remove(14) return 0 - self.assertTrue(Deviant1() not in Deviant1.aList) + self.assertNotIn(Deviant1(), Deviant1.aList) def test_nonreflexive(self): # containment and equality tests involving elements that are @@ -81,7 +81,7 @@ class TestContains(unittest.TestCase): for constructor in constructors: container = constructor(values) for elem in container: - self.assertTrue(elem in container) + self.assertIn(elem, container) self.assertTrue(container == constructor(values)) self.assertTrue(container == container) |