summaryrefslogtreecommitdiff
path: root/numpy/polynomial/tests/test_classes.py
diff options
context:
space:
mode:
authorpatto90 <andrea.pattori@gmail.com>2019-07-13 18:23:49 -0500
committerpatto90 <andrea.pattori@gmail.com>2019-07-13 18:23:49 -0500
commitdc4cdc8c1d388c921dd732596e9130f5db79f40f (patch)
tree55f4f8ebf770c77bca61d413751ec37d46a25427 /numpy/polynomial/tests/test_classes.py
parent66c679342aa6f3d5c81de8fa0273d146896060ad (diff)
downloadnumpy-dc4cdc8c1d388c921dd732596e9130f5db79f40f.tar.gz
add test to hit RankWarning in polyutils._fit
Diffstat (limited to 'numpy/polynomial/tests/test_classes.py')
-rw-r--r--numpy/polynomial/tests/test_classes.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/numpy/polynomial/tests/test_classes.py b/numpy/polynomial/tests/test_classes.py
index 15e24f92b..91426cece 100644
--- a/numpy/polynomial/tests/test_classes.py
+++ b/numpy/polynomial/tests/test_classes.py
@@ -13,10 +13,10 @@ import numpy as np
from numpy.polynomial import (
Polynomial, Legendre, Chebyshev, Laguerre, Hermite, HermiteE)
from numpy.testing import (
- assert_almost_equal, assert_raises, assert_equal, assert_,
+ assert_almost_equal, assert_raises, assert_equal, assert_, assert_warns,
)
from numpy.compat import long
-
+from numpy.polynomial.polyutils import RankWarning
#
# fixtures
@@ -133,6 +133,16 @@ def test_fromroots(Poly):
assert_almost_equal(p2.coef[-1], 1)
+def test_bad_conditioned_fit(Poly):
+
+ x = [0., 0., 1.]
+ y = [1., 2., 3.]
+
+ # check RankWarning is raised
+ with assert_warns(RankWarning):
+ Poly.fit(x, y, 2)
+
+
def test_fit(Poly):
def f(x):