diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-16 22:45:39 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-16 22:45:39 (GMT) |
commit | 4725dc3ff4b9778a527c68e628216bf6b566a8dc (patch) | |
tree | 843efe3d8608937a5b37c4cc4066836f144e90dc /Lib | |
parent | e3eb3ec5c4f3ab553ece492c929f0a8148a61688 (diff) | |
parent | 91b3e77a6a1c3ca3841463dff099275c6497f8d4 (diff) | |
download | cpython-4725dc3ff4b9778a527c68e628216bf6b566a8dc.zip cpython-4725dc3ff4b9778a527c68e628216bf6b566a8dc.tar.gz cpython-4725dc3ff4b9778a527c68e628216bf6b566a8dc.tar.bz2 |
Issue #19604: Use specific asserts in array tests.
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/test/test_array.py | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index a5c4f23..4978c44 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -195,7 +195,7 @@ class BaseTest: def test_constructor(self): a = array.array(self.typecode) self.assertEqual(a.typecode, self.typecode) - self.assertTrue(a.itemsize>=self.minitemsize) + self.assertGreaterEqual(a.itemsize, self.minitemsize) self.assertRaises(TypeError, array.array, self.typecode, None) def test_len(self): @@ -442,39 +442,39 @@ class BaseTest: def test_cmp(self): a = array.array(self.typecode, self.example) - self.assertTrue((a == 42) is False) - self.assertTrue((a != 42) is True) + self.assertIs(a == 42, False) + self.assertIs(a != 42, True) - self.assertTrue((a == a) is True) - self.assertTrue((a != a) is False) - self.assertTrue((a < a) is False) - self.assertTrue((a <= a) is True) - self.assertTrue((a > a) is False) - self.assertTrue((a >= a) is True) + self.assertIs(a == a, True) + self.assertIs(a != a, False) + self.assertIs(a < a, False) + self.assertIs(a <= a, True) + self.assertIs(a > a, False) + self.assertIs(a >= a, True) al = array.array(self.typecode, self.smallerexample) ab = array.array(self.typecode, self.biggerexample) - self.assertTrue((a == 2*a) is False) - self.assertTrue((a != 2*a) is True) - self.assertTrue((a < 2*a) is True) - self.assertTrue((a <= 2*a) is True) - self.assertTrue((a > 2*a) is False) - self.assertTrue((a >= 2*a) is False) - - self.assertTrue((a == al) is False) - self.assertTrue((a != al) is True) - self.assertTrue((a < al) is False) - self.assertTrue((a <= al) is False) - self.assertTrue((a > al) is True) - self.assertTrue((a >= al) is True) - - self.assertTrue((a == ab) is False) - self.assertTrue((a != ab) is True) - self.assertTrue((a < ab) is True) - self.assertTrue((a <= ab) is True) - self.assertTrue((a > ab) is False) - self.assertTrue((a >= ab) is False) + self.assertIs(a == 2*a, False) + self.assertIs(a != 2*a, True) + self.assertIs(a < 2*a, True) + self.assertIs(a <= 2*a, True) + self.assertIs(a > 2*a, False) + self.assertIs(a >= 2*a, False) + + self.assertIs(a == al, False) + self.assertIs(a != al, True) + self.assertIs(a < al, False) + self.assertIs(a <= al, False) + self.assertIs(a > al, True) + self.assertIs(a >= al, True) + + self.assertIs(a == ab, False) + self.assertIs(a != ab, True) + self.assertIs(a < ab, True) + self.assertIs(a <= ab, True) + self.assertIs(a > ab, False) + self.assertIs(a >= ab, False) def test_add(self): a = array.array(self.typecode, self.example) \ @@ -493,7 +493,7 @@ class BaseTest: a = array.array(self.typecode, self.example[::-1]) b = a a += array.array(self.typecode, 2*self.example) - self.assertTrue(a is b) + self.assertIs(a, b) self.assertEqual( a, array.array(self.typecode, self.example[::-1]+2*self.example) @@ -548,22 +548,22 @@ class BaseTest: b = a a *= 5 - self.assertTrue(a is b) + self.assertIs(a, b) self.assertEqual( a, array.array(self.typecode, 5*self.example) ) a *= 0 - self.assertTrue(a is b) + self.assertIs(a, b) self.assertEqual(a, array.array(self.typecode)) a *= 1000 - self.assertTrue(a is b) + self.assertIs(a, b) self.assertEqual(a, array.array(self.typecode)) a *= -1 - self.assertTrue(a is b) + self.assertIs(a, b) self.assertEqual(a, array.array(self.typecode)) a = array.array(self.typecode, self.example) |