diff options
Diffstat (limited to 'Lib/test/test_memoryview.py')
-rw-r--r-- | Lib/test/test_memoryview.py | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py index 3f82307..fd820b6 100644 --- a/Lib/test/test_memoryview.py +++ b/Lib/test/test_memoryview.py @@ -27,11 +27,11 @@ class AbstractMemoryTests: b = tp(self._source) oldrefcount = sys.getrefcount(b) m = self._view(b) - self.assertEquals(m[0], item(b"a")) + self.assertEqual(m[0], item(b"a")) self.assertTrue(isinstance(m[0], bytes), type(m[0])) - self.assertEquals(m[5], item(b"f")) - self.assertEquals(m[-1], item(b"f")) - self.assertEquals(m[-6], item(b"a")) + self.assertEqual(m[5], item(b"f")) + self.assertEqual(m[-1], item(b"f")) + self.assertEqual(m[-6], item(b"a")) # Bounds checking self.assertRaises(IndexError, lambda: m[6]) self.assertRaises(IndexError, lambda: m[-7]) @@ -42,7 +42,7 @@ class AbstractMemoryTests: self.assertRaises(TypeError, lambda: m[0.0]) self.assertRaises(TypeError, lambda: m["a"]) m = None - self.assertEquals(sys.getrefcount(b), oldrefcount) + self.assertEqual(sys.getrefcount(b), oldrefcount) def test_getitem(self): for tp in self._types: @@ -66,7 +66,7 @@ class AbstractMemoryTests: self.assertRaises(TypeError, setitem, 65) self.assertRaises(TypeError, setitem, memoryview(b"a")) m = None - self.assertEquals(sys.getrefcount(b), oldrefcount) + self.assertEqual(sys.getrefcount(b), oldrefcount) def test_setitem_writable(self): if not self.rw_type: @@ -109,7 +109,7 @@ class AbstractMemoryTests: self.assertRaises(ValueError, setitem, slice(0,2), b"a") m = None - self.assertEquals(sys.getrefcount(b), oldrefcount) + self.assertEqual(sys.getrefcount(b), oldrefcount) def test_delitem(self): for tp in self._types: @@ -127,14 +127,14 @@ class AbstractMemoryTests: # This calls self.getitem_type() on each separate byte of b"abcdef" expected = b"".join( self.getitem_type(bytes([c])) for c in b"abcdef") - self.assertEquals(b, expected) + self.assertEqual(b, expected) self.assertTrue(isinstance(b, bytes), type(b)) def test_tolist(self): for tp in self._types: m = self._view(tp(self._source)) l = m.tolist() - self.assertEquals(l, list(b"abcdef")) + self.assertEqual(l, list(b"abcdef")) def test_compare(self): # memoryviews can compare for equality with other objects @@ -168,26 +168,26 @@ class AbstractMemoryTests: def check_attributes_with_type(self, tp): m = self._view(tp(self._source)) - self.assertEquals(m.format, self.format) - self.assertEquals(m.itemsize, self.itemsize) - self.assertEquals(m.ndim, 1) - self.assertEquals(m.shape, (6,)) - self.assertEquals(len(m), 6) - self.assertEquals(m.strides, (self.itemsize,)) - self.assertEquals(m.suboffsets, None) + self.assertEqual(m.format, self.format) + self.assertEqual(m.itemsize, self.itemsize) + self.assertEqual(m.ndim, 1) + self.assertEqual(m.shape, (6,)) + self.assertEqual(len(m), 6) + self.assertEqual(m.strides, (self.itemsize,)) + self.assertEqual(m.suboffsets, None) return m def test_attributes_readonly(self): if not self.ro_type: return m = self.check_attributes_with_type(self.ro_type) - self.assertEquals(m.readonly, True) + self.assertEqual(m.readonly, True) def test_attributes_writable(self): if not self.rw_type: return m = self.check_attributes_with_type(self.rw_type) - self.assertEquals(m.readonly, False) + self.assertEqual(m.readonly, False) def test_getbuffer(self): # Test PyObject_GetBuffer() on a memoryview object. @@ -198,9 +198,9 @@ class AbstractMemoryTests: oldviewrefcount = sys.getrefcount(m) s = str(m, "utf-8") self._check_contents(tp, b, s.encode("utf-8")) - self.assertEquals(sys.getrefcount(m), oldviewrefcount) + self.assertEqual(sys.getrefcount(m), oldviewrefcount) m = None - self.assertEquals(sys.getrefcount(b), oldrefcount) + self.assertEqual(sys.getrefcount(b), oldrefcount) def test_gc(self): for tp in self._types: @@ -262,7 +262,7 @@ class BaseMemoryviewTests: return memoryview(obj) def _check_contents(self, tp, obj, contents): - self.assertEquals(obj, tp(contents)) + self.assertEqual(obj, tp(contents)) class BaseMemorySliceTests: source_bytes = b"XabcdefY" @@ -272,14 +272,14 @@ class BaseMemorySliceTests: return m[1:7] def _check_contents(self, tp, obj, contents): - self.assertEquals(obj[1:7], tp(contents)) + self.assertEqual(obj[1:7], tp(contents)) def test_refs(self): for tp in self._types: m = memoryview(tp(self._source)) oldrefcount = sys.getrefcount(m) m[1:2] - self.assertEquals(sys.getrefcount(m), oldrefcount) + self.assertEqual(sys.getrefcount(m), oldrefcount) class BaseMemorySliceSliceTests: source_bytes = b"XabcdefY" @@ -289,7 +289,7 @@ class BaseMemorySliceSliceTests: return m[:7][1:] def _check_contents(self, tp, obj, contents): - self.assertEquals(obj[1:7], tp(contents)) + self.assertEqual(obj[1:7], tp(contents)) # Concrete test classes @@ -316,7 +316,7 @@ class ArrayMemoryviewTest(unittest.TestCase, m = memoryview(a) new_a = array.array('i', range(9, -1, -1)) m[:] = new_a - self.assertEquals(a, new_a) + self.assertEqual(a, new_a) class BytesMemorySliceTest(unittest.TestCase, |