From 3c0cf05901ea5cca0694734fd4a64b2bc267cb41 Mon Sep 17 00:00:00 2001 From: Stefan Krah Date: Thu, 29 Jan 2015 17:33:31 +0100 Subject: [PATCH] Issue #22668: Remove endianness assumption in test. --- Lib/test/test_memoryview.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py index bd9d0d472c0..4bc31330b78 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)