[Python-checkins] cpython (3.4): Issue #22668: Remove endianness assumption in test.

stefan.krah python-checkins at python.org
Thu Jan 29 17:41:54 CET 2015


https://hg.python.org/cpython/rev/9a4af12dcc9d
changeset: 94375:9a4af12dcc9d
branch: 3.4
parent: 94372:e9c1fca50b46
user: Stefan Krah <skrah at bytereef.org>
date: Thu Jan 29 17:33:31 2015 +0100
summary:
 Issue #22668: Remove endianness assumption in test.
files:
 Lib/test/test_memoryview.py | 8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py
--- a/Lib/test/test_memoryview.py
+++ b/Lib/test/test_memoryview.py
@@ -361,18 +361,20 @@
 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)
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /