Author: Matti Picus <[email protected]>
Branch: memoryview-attributes
Changeset: r86190:ac8183b0c6c2
Date: 2016-08-14 22:08 +0300
http://bitbucket.org/pypy/pypy/changeset/ac8183b0c6c2/
Log: add more passing tests for memoryview attributes
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
@@ -3635,11 +3635,24 @@
def test_memoryview(self):
import numpy as np
+ import sys
+ if sys.version_info[:2] > (3, 2):
+ # In Python 3.3 the representation of empty shape, strides and
sub-offsets
+ # is an empty tuple instead of None.
+ # http://docs.python.org/dev/whatsnew/3.3.html#api-changes
+ EMPTY = ()
+ else:
+ EMPTY = None
x = np.array([1, 2, 3, 4, 5], dtype='i')
y = memoryview('abc')
assert y.format == 'B'
y = memoryview(x)
assert y.format == 'i'
+ assert y.shape == (5,)
+ assert y.ndim == 1
+ assert y.strides == (4,)
+ assert y.suboffsets == EMPTY
+ assert y.itemsize == 4
def test_fromstring(self):
import sys
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit