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
|
@ -413,7 +413,7 @@ class MmapTests(unittest.TestCase):
|
|||
data = bytes(reversed(data))
|
||||
L[start:stop:step] = data
|
||||
m[start:stop:step] = data
|
||||
self.assertEquals(m[:], bytes(L))
|
||||
self.assertEqual(m[:], bytes(L))
|
||||
|
||||
def make_mmap_file (self, f, halfsize):
|
||||
# Write 2 pages worth of data to the file
|
||||
|
@ -510,27 +510,27 @@ class MmapTests(unittest.TestCase):
|
|||
f.close()
|
||||
# Test write_byte()
|
||||
for i in range(len(data)):
|
||||
self.assertEquals(m.tell(), i)
|
||||
self.assertEqual(m.tell(), i)
|
||||
m.write_byte(data[i])
|
||||
self.assertEquals(m.tell(), i+1)
|
||||
self.assertEqual(m.tell(), i+1)
|
||||
self.assertRaises(ValueError, m.write_byte, b"x"[0])
|
||||
self.assertEquals(m[:], data)
|
||||
self.assertEqual(m[:], data)
|
||||
# Test read_byte()
|
||||
m.seek(0)
|
||||
for i in range(len(data)):
|
||||
self.assertEquals(m.tell(), i)
|
||||
self.assertEquals(m.read_byte(), data[i])
|
||||
self.assertEquals(m.tell(), i+1)
|
||||
self.assertEqual(m.tell(), i)
|
||||
self.assertEqual(m.read_byte(), data[i])
|
||||
self.assertEqual(m.tell(), i+1)
|
||||
self.assertRaises(ValueError, m.read_byte)
|
||||
# Test read()
|
||||
m.seek(3)
|
||||
self.assertEquals(m.read(3), b"345")
|
||||
self.assertEquals(m.tell(), 6)
|
||||
self.assertEqual(m.read(3), b"345")
|
||||
self.assertEqual(m.tell(), 6)
|
||||
# Test write()
|
||||
m.seek(3)
|
||||
m.write(b"bar")
|
||||
self.assertEquals(m.tell(), 6)
|
||||
self.assertEquals(m[:], b"012bar6789")
|
||||
self.assertEqual(m.tell(), 6)
|
||||
self.assertEqual(m[:], b"012bar6789")
|
||||
m.seek(8)
|
||||
self.assertRaises(ValueError, m.write, b"bar")
|
||||
|
||||
|
@ -538,9 +538,9 @@ class MmapTests(unittest.TestCase):
|
|||
for b in (129, 200, 255): # > 128
|
||||
m = mmap.mmap(-1, 1)
|
||||
m.write_byte(b)
|
||||
self.assertEquals(m[0], b)
|
||||
self.assertEqual(m[0], b)
|
||||
m.seek(0)
|
||||
self.assertEquals(m.read_byte(), b)
|
||||
self.assertEqual(m.read_byte(), b)
|
||||
m.close()
|
||||
|
||||
if os.name == 'nt':
|
||||
|
@ -554,8 +554,8 @@ class MmapTests(unittest.TestCase):
|
|||
m1[:] = data1
|
||||
m2 = mmap.mmap(-1, len(data2), tagname="foo")
|
||||
m2[:] = data2
|
||||
self.assertEquals(m1[:], data2)
|
||||
self.assertEquals(m2[:], data2)
|
||||
self.assertEqual(m1[:], data2)
|
||||
self.assertEqual(m2[:], data2)
|
||||
m2.close()
|
||||
m1.close()
|
||||
|
||||
|
@ -564,8 +564,8 @@ class MmapTests(unittest.TestCase):
|
|||
m1[:] = data1
|
||||
m2 = mmap.mmap(-1, len(data2), tagname="boo")
|
||||
m2[:] = data2
|
||||
self.assertEquals(m1[:], data1)
|
||||
self.assertEquals(m2[:], data2)
|
||||
self.assertEqual(m1[:], data1)
|
||||
self.assertEqual(m2[:], data2)
|
||||
m2.close()
|
||||
m1.close()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue