summaryrefslogtreecommitdiff
path: root/numpy/polynomial/tests/test_classes.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2017-03-30 20:51:09 -0600
committerCharles Harris <charlesr.harris@gmail.com>2017-04-27 21:16:55 -0600
commitc7f7199fe9907ab94024a422e626affcf1a64d14 (patch)
treee90c1f9cb0219fe5fb3de1b1008a135d1a6b7208 /numpy/polynomial/tests/test_classes.py
parente4f756be30c5c431550426b4404ac508ddf0fb40 (diff)
downloadnumpy-c7f7199fe9907ab94024a422e626affcf1a64d14.tar.gz
ENH: Use `__array_ufunc__ = None` in polynomial convenience classes.
Add `__array_ufunc__ = None` to ABCPolyBase. This ensures that polynomial convenience classes will not participate in ufuncs and will have priority when combined with an ndarray in a Python binary operator. `__array_priority__` is removed, as it is no longer needed.
Diffstat (limited to 'numpy/polynomial/tests/test_classes.py')
-rw-r--r--numpy/polynomial/tests/test_classes.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/polynomial/tests/test_classes.py b/numpy/polynomial/tests/test_classes.py
index a7cf7209c..46d721df4 100644
--- a/numpy/polynomial/tests/test_classes.py
+++ b/numpy/polynomial/tests/test_classes.py
@@ -53,6 +53,7 @@ def test_class_methods():
yield check_cutdeg, Poly
yield check_truncate, Poly
yield check_trim, Poly
+ yield check_ufunc_override, Poly
#
@@ -575,5 +576,12 @@ def check_mapparms(Poly):
assert_almost_equal([1, 2], p.mapparms())
+def check_ufunc_override(Poly):
+ p = Poly([1, 2, 3])
+ x = np.ones(3)
+ assert_raises(TypeError, np.add, p, x)
+ assert_raises(TypeError, np.add, x, p)
+
+
if __name__ == "__main__":
run_module_suite()