diff -r 3b94a4ef244e Lib/test/test_bigmem.py --- a/Lib/test/test_bigmem.py Fri Feb 07 17:53:13 2014 +0100 +++ b/Lib/test/test_bigmem.py Fri Feb 07 21:41:22 2014 +0200 @@ -118,7 +118,7 @@ _ = self.from_latin1 s = _('-') * size tabsize = 8 - self.assertTrue(s.expandtabs() == s) + self.assertEqual(s.expandtabs(), s) del s slen, remainder = divmod(size, tabsize) s = _(' \t') * slen @@ -270,7 +270,7 @@ # Type-specific optimization if isinstance(s, (str, bytes)): stripped = s.lstrip() - self.assertTrue(stripped is s) + self.assertIs(stripped, s) @bigmemtest(size=_2G + 10, memuse=2) def test_replace(self, size): @@ -342,7 +342,7 @@ # Type-specific optimization if isinstance(s, (str, bytes)): stripped = s.rstrip() - self.assertTrue(stripped is s) + self.assertIs(stripped, s) # The test takes about size bytes to build a string, and then about # sqrt(size) substrings of sqrt(size) in size and a list to @@ -536,12 +536,12 @@ edge = _('-') * (size // 2) s = _('').join([edge, SUBSTR, edge]) del edge - self.assertTrue(SUBSTR in s) - self.assertFalse(SUBSTR * 2 in s) - self.assertTrue(_('-') in s) - self.assertFalse(_('a') in s) + self.assertIn(SUBSTR, s) + self.assertNotIn(SUBSTR * 2, s) + self.assertIn(_('-'), s) + self.assertNotIn(_('a'), s) s += _('a') - self.assertTrue(_('a') in s) + self.assertIn(_('a'), s) @bigmemtest(size=_2G + 10, memuse=2) def test_compare(self, size): @@ -655,7 +655,7 @@ def test_format(self, size): s = '-' * size sf = '%s' % (s,) - self.assertTrue(s == sf) + self.assertEqual(s, sf) del sf sf = '..%s..' % (s,) self.assertEqual(len(sf), len(s) + 4) @@ -856,9 +856,9 @@ def test_contains(self, size): t = (1, 2, 3, 4, 5) * size self.assertEqual(len(t), size * 5) - self.assertTrue(5 in t) - self.assertFalse((1, 2, 3, 4, 5) in t) - self.assertFalse(0 in t) + self.assertIn(5, t) + self.assertNotIn((1, 2, 3, 4, 5), t) + self.assertNotIn(0, t) @bigmemtest(size=_2G + 10, memuse=8) def test_hash(self, size): @@ -866,7 +866,7 @@ h1 = hash(t1) del t1 t2 = (0,) * (size + 1) - self.assertFalse(h1 == hash(t2)) + self.assertNotEqual(h1, hash(t2)) @bigmemtest(size=_2G + 10, memuse=8) def test_index_and_slice(self, size): @@ -992,8 +992,8 @@ l = [sys.stdout] * size l += l self.assertEqual(len(l), size * 2) - self.assertTrue(l[0] is l[-1]) - self.assertTrue(l[size - 1] is l[size + 1]) + self.assertIs(l[0], l[-1]) + self.assertIs(l[size - 1], l[size + 1]) @bigmemtest(size=_2G // 2 + 2, memuse=24) def test_inplace_concat_small(self, size): @@ -1007,9 +1007,9 @@ def test_contains(self, size): l = [1, 2, 3, 4, 5] * size self.assertEqual(len(l), size * 5) - self.assertTrue(5 in l) - self.assertFalse([1, 2, 3, 4, 5] in l) - self.assertFalse(0 in l) + self.assertIn(5, l) + self.assertNotIn([1, 2, 3, 4, 5], l) + self.assertNotIn(0, l) @bigmemtest(size=_2G + 10, memuse=8) def test_hash(self, size): @@ -1092,13 +1092,13 @@ l = [''] l *= size self.assertEqual(len(l), size) - self.assertTrue(l[0] is l[-1]) + self.assertIs(l[0], l[-1]) del l l = [''] * size l *= 2 self.assertEqual(len(l), size * 2) - self.assertTrue(l[size - 1] is l[-1]) + self.assertIs(l[size - 1], l[-1]) @bigmemtest(size=_2G // 2 + 2, memuse=16) def test_inplace_repeat_small(self, size): @@ -1132,8 +1132,8 @@ l = [object()] * size l.append(object()) self.assertEqual(len(l), size+1) - self.assertTrue(l[-3] is l[-2]) - self.assertFalse(l[-2] is l[-1]) + self.assertIs(l[-3], l[-2]) + self.assertIsNot(l[-2], l[-1]) @bigmemtest(size=_2G // 5 + 2, memuse=8 * 5) def test_count(self, size): @@ -1145,8 +1145,8 @@ l = [object] * size l.extend(l) self.assertEqual(len(l), size * 2) - self.assertTrue(l[0] is l[-1]) - self.assertTrue(l[size - 1] is l[size + 1]) + self.assertIs(l[0], l[-1]) + self.assertIs(l[size - 1], l[size + 1]) @bigmemtest(size=_2G // 2 + 2, memuse=16) def test_extend_small(self, size):