[Python-checkins] cpython: Fix copy&paste errors and reformulate the tests.

stefan.krah python-checkins at python.org
Sun Nov 4 21:05:39 CET 2012


http://hg.python.org/cpython/rev/fc8f1b1c76bf
changeset:   80245:fc8f1b1c76bf
user:        Stefan Krah <skrah at bytereef.org>
date:        Sun Nov 04 20:53:50 2012 +0100
summary:
  Fix copy&paste errors and reformulate the tests.

files:
  Lib/test/test_buffer.py |  20 +++++---------------
  1 files changed, 5 insertions(+), 15 deletions(-)


diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -4001,23 +4001,13 @@
 
         # equality-hash invariant
         x = ndarray(list(range(12)), shape=[12], format='B')
-        a = memoryview(nd)
+        a = memoryview(x)
 
         y = ndarray(list(range(12)), shape=[12], format='b')
-        b = memoryview(nd)
-
-        z = ndarray(list(bytes(chr(x), 'latin-1') for x in range(12)),
-                    shape=[12], format='c')
-        c = memoryview(nd)
-
-        if (a == b):
-            self.assertEqual(hash(a), hash(b))
-
-        if (a == c):
-            self.assertEqual(hash(a), hash(c))
-
-        if (b == c):
-            self.assertEqual(hash(b), hash(c))
+        b = memoryview(y)
+
+        self.assertEqual(a, b)
+        self.assertEqual(hash(a), hash(b))
 
         # non-byte formats
         nd = ndarray(list(range(12)), shape=[2,2,3], format='L')

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list