mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
#9424: Replace deprecated assert* methods in the Python test suite.
This commit is contained in:
parent
b8bc439b20
commit
b3aedd4862
170 changed files with 2388 additions and 2392 deletions
|
@ -266,11 +266,11 @@ class BaseBytesTest(unittest.TestCase):
|
|||
def test_fromhex(self):
|
||||
self.assertRaises(TypeError, self.type2test.fromhex)
|
||||
self.assertRaises(TypeError, self.type2test.fromhex, 1)
|
||||
self.assertEquals(self.type2test.fromhex(''), self.type2test())
|
||||
self.assertEqual(self.type2test.fromhex(''), self.type2test())
|
||||
b = bytearray([0x1a, 0x2b, 0x30])
|
||||
self.assertEquals(self.type2test.fromhex('1a2B30'), b)
|
||||
self.assertEquals(self.type2test.fromhex(' 1A 2B 30 '), b)
|
||||
self.assertEquals(self.type2test.fromhex('0000'), b'\0\0')
|
||||
self.assertEqual(self.type2test.fromhex('1a2B30'), b)
|
||||
self.assertEqual(self.type2test.fromhex(' 1A 2B 30 '), b)
|
||||
self.assertEqual(self.type2test.fromhex('0000'), b'\0\0')
|
||||
self.assertRaises(TypeError, self.type2test.fromhex, b'1B')
|
||||
self.assertRaises(ValueError, self.type2test.fromhex, 'a')
|
||||
self.assertRaises(ValueError, self.type2test.fromhex, 'rt')
|
||||
|
@ -626,11 +626,11 @@ class ByteArrayTest(BaseBytesTest):
|
|||
data.reverse()
|
||||
L[start:stop:step] = data
|
||||
b[start:stop:step] = data
|
||||
self.assertEquals(b, bytearray(L))
|
||||
self.assertEqual(b, bytearray(L))
|
||||
|
||||
del L[start:stop:step]
|
||||
del b[start:stop:step]
|
||||
self.assertEquals(b, bytearray(L))
|
||||
self.assertEqual(b, bytearray(L))
|
||||
|
||||
def test_setslice_trap(self):
|
||||
# This test verifies that we correctly handle assigning self
|
||||
|
@ -809,25 +809,25 @@ class ByteArrayTest(BaseBytesTest):
|
|||
resize(10)
|
||||
orig = b[:]
|
||||
self.assertRaises(BufferError, resize, 11)
|
||||
self.assertEquals(b, orig)
|
||||
self.assertEqual(b, orig)
|
||||
self.assertRaises(BufferError, resize, 9)
|
||||
self.assertEquals(b, orig)
|
||||
self.assertEqual(b, orig)
|
||||
self.assertRaises(BufferError, resize, 0)
|
||||
self.assertEquals(b, orig)
|
||||
self.assertEqual(b, orig)
|
||||
# Other operations implying resize
|
||||
self.assertRaises(BufferError, b.pop, 0)
|
||||
self.assertEquals(b, orig)
|
||||
self.assertEqual(b, orig)
|
||||
self.assertRaises(BufferError, b.remove, b[1])
|
||||
self.assertEquals(b, orig)
|
||||
self.assertEqual(b, orig)
|
||||
def delitem():
|
||||
del b[1]
|
||||
self.assertRaises(BufferError, delitem)
|
||||
self.assertEquals(b, orig)
|
||||
self.assertEqual(b, orig)
|
||||
# deleting a non-contiguous slice
|
||||
def delslice():
|
||||
b[1:-1:2] = b""
|
||||
self.assertRaises(BufferError, delslice)
|
||||
self.assertEquals(b, orig)
|
||||
self.assertEqual(b, orig)
|
||||
|
||||
|
||||
class AssortedBytesTest(unittest.TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue