[pypy-commit] pypy py3.5: Add 2 failing tests for views of memoryviews
rlamy
pypy.commits at gmail.com
Fri Nov 11 11:42:21 EST 2016
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r88315:84366130bc20
Date: 2016-11-11 16:41 +0000
http://bitbucket.org/pypy/pypy/changeset/84366130bc20/
Log: Add 2 failing tests for views of memoryviews
diff --git a/pypy/objspace/std/test/test_memoryobject.py b/pypy/objspace/std/test/test_memoryobject.py
--- a/pypy/objspace/std/test/test_memoryobject.py
+++ b/pypy/objspace/std/test/test_memoryobject.py
@@ -239,6 +239,21 @@
m3[1:5:2] = memoryview(b"xyXY").cast('h')
assert data == bytearray(eval("b'abxyefXYij'"))
+ def test_cast_and_slice(self):
+ import array
+ data = array.array('h', [1, 2])
+ m = memoryview(memoryview(data).cast('B'))
+ assert len(m[2:4:1]) == 2
+
+ def test_cast_and_view(self):
+ import array
+ data = array.array('h', [1, 2])
+ m1 = memoryview(data).cast('B')
+ m2 = memoryview(m1)
+ assert m2.strides == m1.strides
+ assert m2.itemsize == m1.itemsize
+ assert m2.shape == m1.shape
+
class MockBuffer(Buffer):
def __init__(self, space, w_arr, w_dim, w_fmt, \
w_itemsize, w_strides, w_shape):
More information about the pypy-commit
mailing list