summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2015-01-29 16:33:31 (GMT)
committerStefan Krah <skrah@bytereef.org>2015-01-29 16:33:31 (GMT)
commit3c0cf05901ea5cca0694734fd4a64b2bc267cb41 (patch)
treefb3b17c4f02f08f10b008246888bd5a65d24fd9c
parentfa5d6a5ff3ca247d9c2eaf51853ff39c98c09f4a (diff)
downloadcpython-3c0cf05901ea5cca0694734fd4a64b2bc267cb41.zip
cpython-3c0cf05901ea5cca0694734fd4a64b2bc267cb41.tar.gz
cpython-3c0cf05901ea5cca0694734fd4a64b2bc267cb41.tar.bz2
Issue #22668: Remove endianness assumption in test.
-rw-r--r--Lib/test/test_memoryview.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py
index bd9d0d4..4bc3133 100644
--- a/Lib/test/test_memoryview.py
+++ b/Lib/test/test_memoryview.py
@@ -361,18 +361,20 @@ class AbstractMemoryTests:
self.assertEqual(list(reversed(m)), list(m[::-1]))
def test_issue22668(self):
- m = memoryview(bytes(range(8)))
+ a = array.array('H', [256, 256, 256, 256])
+ x = memoryview(a)
+ m = x.cast('B')
b = m.cast('H')
c = b[0:2]
d = memoryview(b)
del b
-
+
self.assertEqual(c[0], 256)
self.assertEqual(d[0], 256)
self.assertEqual(c.format, "H")
self.assertEqual(d.format, "H")
-
+
_ = m.cast('I')
self.assertEqual(c[0], 256)
self.assertEqual(d[0], 256)