[pypy-commit] pypy memoryview-attributes: test showing current memoryview shortcomings

mattip pypy.commits at gmail.com
Sun Aug 14 16:12:14 EDT 2016


Author: Matti Picus <matti.picus at gmail.com>
Branch: memoryview-attributes
Changeset: r86188:56370389b4ea
Date: 2016-08-14 21:17 +0300
http://bitbucket.org/pypy/pypy/changeset/56370389b4ea/

Log:	test showing current memoryview shortcomings

diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -3633,6 +3633,14 @@
         #assert a.base is data.__buffer__
         assert a.tostring() == 'abc'
 
+    def test_memoryview(self):
+        import numpy as np
+        x = np.array([1, 2, 3, 4, 5], dtype='i')
+        y = memoryview('abc')
+        assert y.format == 'B'
+        y = memoryview(x)
+        assert y.format == 'i'
+
     def test_fromstring(self):
         import sys
         from numpy import fromstring, dtype


More information about the pypy-commit mailing list