[pypy-commit] pypy py3.5: Test 0d view on C-created buffer

rlamy pypy.commits at gmail.com
Sat Feb 11 15:11:16 EST 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r90060:9f7edc16f16c
Date: 2017-02-11 20:10 +0000
http://bitbucket.org/pypy/pypy/changeset/9f7edc16f16c/

Log:	Test 0d view on C-created buffer

diff --git a/pypy/module/cpyext/test/test_arraymodule.py b/pypy/module/cpyext/test/test_arraymodule.py
--- a/pypy/module/cpyext/test/test_arraymodule.py
+++ b/pypy/module/cpyext/test/test_arraymodule.py
@@ -69,6 +69,14 @@
                                 b'\x03\0\0\0'
                                 b'\x04\0\0\0')
 
+    def test_0d_view(self):
+        module = self.import_module(name='array')
+        arr = module.array('B', b'\0\0\0\x01')
+        buf = memoryview(arr).cast('i', shape=())
+        assert bytes(buf) == b'\0\0\0\x01'
+        assert buf.shape == ()
+        assert buf.strides == ()
+
     def test_binop_mul_impl(self):
         # check that rmul is called
         module = self.import_module(name='array')


More information about the pypy-commit mailing list