diff options
author | jbCodeHub <besselingcodehub@gmail.com> | 2021-02-28 09:58:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-28 09:58:54 +0100 |
commit | 592b71c8cd10ef3cf9bccebb6c3ed0198f105484 (patch) | |
tree | 00c9fa219be28ef288357b7e87192d5b42b7a686 /numpy/polynomial/tests/test_polyutils.py | |
parent | 1932e4bdc460975d8b35ae8351e037d26e5ee6f8 (diff) | |
download | numpy-592b71c8cd10ef3cf9bccebb6c3ed0198f105484.tar.gz |
TST: Branch coverage improvement for `np.polynomial` (#18499)
* added tests for vander_nd in test_polyutils to cover some of the missed branches
* added tests to polyline and vander to improve branch coverage
* added tests to test_legendre.py to improve branch coverage
Diffstat (limited to 'numpy/polynomial/tests/test_polyutils.py')
-rw-r--r-- | numpy/polynomial/tests/test_polyutils.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/numpy/polynomial/tests/test_polyutils.py b/numpy/polynomial/tests/test_polyutils.py index 1b27f53b5..cc630790d 100644 --- a/numpy/polynomial/tests/test_polyutils.py +++ b/numpy/polynomial/tests/test_polyutils.py @@ -40,6 +40,21 @@ class TestMisc: assert_equal(pu.trimcoef(coef, 1), coef[:-3]) assert_equal(pu.trimcoef(coef, 2), [0]) + def test_vander_nd_exception(self): + # n_dims != len(points) + assert_raises(ValueError, pu._vander_nd, (), (1, 2, 3), [90]) + # n_dims != len(degrees) + assert_raises(ValueError, pu._vander_nd, (), (), [90.65]) + # n_dims == 0 + assert_raises(ValueError, pu._vander_nd, (), (), []) + + def test_div_zerodiv(self): + # c2[-1] == 0 + assert_raises(ZeroDivisionError, pu._div, pu._div, (1, 2, 3), [0]) + + def test_pow_too_large(self): + # power > maxpower + assert_raises(ValueError, pu._pow, (), [1, 2, 3], 5, 4) class TestDomain: |