[pypy-commit] pypy ndarray-view: test view
mattip
noreply at buildbot.pypy.org
Fri Jun 28 14:40:38 CEST 2013
Author: Matti Picus <matti.picus at gmail.com>
Branch: ndarray-view
Changeset: r65056:1cdbf8183c73
Date: 2013-06-28 12:22 +0300
http://bitbucket.org/pypy/pypy/changeset/1cdbf8183c73/
Log: test view
diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -1411,6 +1411,16 @@
assert a[3].imag == -10
assert a[2].imag == -5
+ def test_ndarray_view(self):
+ from numpypy import array, int8, int16, dtype
+ x = array([(1, 2)], dtype=[('a', int8), ('b', int8)])
+ y = x.view(dtype=int16)
+ assert y[0] == 513
+ assert y.dtype == dtype('int16')
+ y[0] = 670
+ assert x['a'] == -98
+ assert x['b'] == 2
+
def test_tolist_scalar(self):
from numpypy import int32, bool_
x = int32(23)
More information about the pypy-commit
mailing list