mirror of
https://github.com/python/cpython.git
synced 2025-08-29 05:05:03 +00:00
convert old fail* assertions to assert*
This commit is contained in:
parent
98d23f2e06
commit
c9c0f201fe
275 changed files with 4540 additions and 4540 deletions
|
@ -49,7 +49,7 @@ class BaseTest(unittest.TestCase):
|
|||
def test_constructor(self):
|
||||
a = array.array(self.typecode)
|
||||
self.assertEqual(a.typecode, self.typecode)
|
||||
self.assert_(a.itemsize>=self.minitemsize)
|
||||
self.assertTrue(a.itemsize>=self.minitemsize)
|
||||
self.assertRaises(TypeError, array.array, self.typecode, None)
|
||||
|
||||
def test_len(self):
|
||||
|
@ -64,10 +64,10 @@ class BaseTest(unittest.TestCase):
|
|||
a = array.array(self.typecode, self.example)
|
||||
self.assertRaises(TypeError, a.buffer_info, 42)
|
||||
bi = a.buffer_info()
|
||||
self.assert_(isinstance(bi, tuple))
|
||||
self.assertTrue(isinstance(bi, tuple))
|
||||
self.assertEqual(len(bi), 2)
|
||||
self.assert_(isinstance(bi[0], int))
|
||||
self.assert_(isinstance(bi[1], int))
|
||||
self.assertTrue(isinstance(bi[0], int))
|
||||
self.assertTrue(isinstance(bi[1], int))
|
||||
self.assertEqual(bi[1], len(a))
|
||||
|
||||
def test_byteswap(self):
|
||||
|
@ -216,39 +216,39 @@ class BaseTest(unittest.TestCase):
|
|||
|
||||
def test_cmp(self):
|
||||
a = array.array(self.typecode, self.example)
|
||||
self.assert_((a == 42) is False)
|
||||
self.assert_((a != 42) is True)
|
||||
self.assertTrue((a == 42) is False)
|
||||
self.assertTrue((a != 42) is True)
|
||||
|
||||
self.assert_((a == a) is True)
|
||||
self.assert_((a != a) is False)
|
||||
self.assert_((a < a) is False)
|
||||
self.assert_((a <= a) is True)
|
||||
self.assert_((a > a) is False)
|
||||
self.assert_((a >= a) is 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)
|
||||
|
||||
al = array.array(self.typecode, self.smallerexample)
|
||||
ab = array.array(self.typecode, self.biggerexample)
|
||||
|
||||
self.assert_((a == 2*a) is False)
|
||||
self.assert_((a != 2*a) is True)
|
||||
self.assert_((a < 2*a) is True)
|
||||
self.assert_((a <= 2*a) is True)
|
||||
self.assert_((a > 2*a) is False)
|
||||
self.assert_((a >= 2*a) is False)
|
||||
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.assert_((a == al) is False)
|
||||
self.assert_((a != al) is True)
|
||||
self.assert_((a < al) is False)
|
||||
self.assert_((a <= al) is False)
|
||||
self.assert_((a > al) is True)
|
||||
self.assert_((a >= al) is True)
|
||||
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.assert_((a == ab) is False)
|
||||
self.assert_((a != ab) is True)
|
||||
self.assert_((a < ab) is True)
|
||||
self.assert_((a <= ab) is True)
|
||||
self.assert_((a > ab) is False)
|
||||
self.assert_((a >= ab) is False)
|
||||
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)
|
||||
|
||||
def test_add(self):
|
||||
a = array.array(self.typecode, self.example) \
|
||||
|
@ -267,7 +267,7 @@ class BaseTest(unittest.TestCase):
|
|||
a = array.array(self.typecode, self.example[::-1])
|
||||
b = a
|
||||
a += array.array(self.typecode, 2*self.example)
|
||||
self.assert_(a is b)
|
||||
self.assertTrue(a is b)
|
||||
self.assertEqual(
|
||||
a,
|
||||
array.array(self.typecode, self.example[::-1]+2*self.example)
|
||||
|
@ -310,22 +310,22 @@ class BaseTest(unittest.TestCase):
|
|||
b = a
|
||||
|
||||
a *= 5
|
||||
self.assert_(a is b)
|
||||
self.assertTrue(a is b)
|
||||
self.assertEqual(
|
||||
a,
|
||||
array.array(self.typecode, 5*self.example)
|
||||
)
|
||||
|
||||
a *= 0
|
||||
self.assert_(a is b)
|
||||
self.assertTrue(a is b)
|
||||
self.assertEqual(a, array.array(self.typecode))
|
||||
|
||||
a *= 1000
|
||||
self.assert_(a is b)
|
||||
self.assertTrue(a is b)
|
||||
self.assertEqual(a, array.array(self.typecode))
|
||||
|
||||
a *= -1
|
||||
self.assert_(a is b)
|
||||
self.assertTrue(a is b)
|
||||
self.assertEqual(a, array.array(self.typecode))
|
||||
|
||||
a = array.array(self.typecode, self.example)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue