Author: Romain Guillebert <[email protected]>
Branch: numpypy-array_prepare_-array_wrap
Changeset: r68844:4685b47e9d49
Date: 2014-01-22 17:15 +0100
http://bitbucket.org/pypy/pypy/changeset/4685b47e9d49/
Log: More tests
diff --git a/pypy/module/micronumpy/test/test_subtype.py
b/pypy/module/micronumpy/test/test_subtype.py
--- a/pypy/module/micronumpy/test/test_subtype.py
+++ b/pypy/module/micronumpy/test/test_subtype.py
@@ -311,6 +311,11 @@
assert type(x) == with_prepare
assert x.called_prepare
raises(TypeError, add, a, b, out=c)
+ a = array(1).view(type=with_prepare)
+ b = array(1)
+ x = add(a, b)
+ assert x == 2
+ assert x.called_prepare
def test___array_prepare__1arg_scalar(self):
from numpypy import ndarray, array, log, ones
@@ -368,6 +373,16 @@
assert x.called_prepare
raises(TypeError, add, a, b, out=c)
+ def test_result_is_subtype(self):
+ from numpypy import ndarray, add, array
+ class subtype(ndarray):
+ pass
+
+ a = array(10).view(subtype)
+ b = 10
+ res = add(a, b)
+ assert isinstance(res, subtype)
+
def test__getitem_modifies_shape(self):
import numpypy as N
# numpy's matrix class caused an infinite loop
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit