summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorMichael Droettboom <mdboom@gmail.com>2014-09-19 17:15:07 -0400
committerMichael Droettboom <mdboom@gmail.com>2014-09-19 17:15:07 -0400
commitffacca0b2384fecbf383df137546db02f101e993 (patch)
tree58ead90b84b2bfb73c27e91db0987aa29219caa5 /numpy/core
parent0c6fd4875acc733165ca71301c661535aaebed93 (diff)
downloadnumpy-ffacca0b2384fecbf383df137546db02f101e993.tar.gz
Explicitly set strides with negative number in test
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/tests/test_multiarray.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index a9b2d751f..9eeb47fc0 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -4260,19 +4260,20 @@ class TestNewBufferProtocol(object):
def test_relaxed_strides(self):
# Test that relaxed strides are converted to non-relaxed
- x = np.zeros((5, 10), dtype=">f4")
+ c = np.ones((1, 10, 10), dtype='i8')
- # Add an extra dimension in such a way that the strides will
- # contain -1 markers
- c = np.array([x])
- assert memoryview(c).strides == (200, 40, 4)
+ # Check for NPY_RELAXED_STRIDES_CHECKING:
+ if np.ones((10, 1), order="C").flags.f_contiguous:
+ c.strides = (-1, 80, 8)
+
+ assert memoryview(c).strides == (800, 80, 8)
# Writing C-contiguous data to a BytesIO buffer should work
fd = io.BytesIO()
fd.write(c.data)
fortran = c.T
- assert memoryview(fortran).strides == (4, 40, 200)
+ assert memoryview(fortran).strides == (8, 80, 800)
class TestArrayAttributeDeletion(object):