summaryrefslogtreecommitdiff
path: root/numpy/polynomial
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2017-07-24 15:17:42 -0500
committerGitHub <noreply@github.com>2017-07-24 15:17:42 -0500
commitf84274100090d52366e5218696b1b8d3a8c73a44 (patch)
tree69c8bbf64ad43704d685ccfc591e972e25557fe2 /numpy/polynomial
parent6958be1c9180bd52a7aaf979718b2b851f280055 (diff)
parent69bc7b19d2a665c8301c3df07aee61fc469ff4e3 (diff)
downloadpython-numpy-f84274100090d52366e5218696b1b8d3a8c73a44.tar.gz
python-numpy-f84274100090d52366e5218696b1b8d3a8c73a44.tar.bz2
python-numpy-f84274100090d52366e5218696b1b8d3a8c73a44.zip
Merge pull request #9434 from charris/remove-unittest-dependencies
Remove unittest dependencies
Diffstat (limited to 'numpy/polynomial')
-rw-r--r--numpy/polynomial/tests/test_chebyshev.py27
-rw-r--r--numpy/polynomial/tests/test_hermite.py25
-rw-r--r--numpy/polynomial/tests/test_hermite_e.py25
-rw-r--r--numpy/polynomial/tests/test_laguerre.py25
-rw-r--r--numpy/polynomial/tests/test_legendre.py25
-rw-r--r--numpy/polynomial/tests/test_polynomial.py21
-rw-r--r--numpy/polynomial/tests/test_polyutils.py9
-rw-r--r--numpy/polynomial/tests/test_printing.py6
8 files changed, 85 insertions, 78 deletions
diff --git a/numpy/polynomial/tests/test_chebyshev.py b/numpy/polynomial/tests/test_chebyshev.py
index dc0cd14b3..2e4344731 100644
--- a/numpy/polynomial/tests/test_chebyshev.py
+++ b/numpy/polynomial/tests/test_chebyshev.py
@@ -7,8 +7,9 @@ import numpy as np
import numpy.polynomial.chebyshev as cheb
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
- TestCase, assert_almost_equal, assert_raises,
- assert_equal, assert_, run_module_suite)
+ assert_almost_equal, assert_raises, assert_equal, assert_,
+ run_module_suite
+ )
def trim(x):
@@ -28,7 +29,7 @@ T9 = [0, 9, 0, -120, 0, 432, 0, -576, 0, 256]
Tlist = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
-class TestPrivate(TestCase):
+class TestPrivate(object):
def test__cseries_to_zseries(self):
for i in range(5):
@@ -45,7 +46,7 @@ class TestPrivate(TestCase):
assert_equal(res, tgt)
-class TestConstants(TestCase):
+class TestConstants(object):
def test_chebdomain(self):
assert_equal(cheb.chebdomain, [-1, 1])
@@ -60,7 +61,7 @@ class TestConstants(TestCase):
assert_equal(cheb.chebx, [0, 1])
-class TestArithmetic(TestCase):
+class TestArithmetic(object):
def test_chebadd(self):
for i in range(5):
@@ -112,7 +113,7 @@ class TestArithmetic(TestCase):
assert_equal(trim(res), trim(tgt), err_msg=msg)
-class TestEvaluation(TestCase):
+class TestEvaluation(object):
# coefficients of 1 + 2*x + 3*x**2
c1d = np.array([2.5, 2., 1.5])
c2d = np.einsum('i,j->ij', c1d, c1d)
@@ -206,7 +207,7 @@ class TestEvaluation(TestCase):
assert_(res.shape == (2, 3)*3)
-class TestIntegral(TestCase):
+class TestIntegral(object):
def test_chebint(self):
# check exceptions
@@ -305,7 +306,7 @@ class TestIntegral(TestCase):
assert_almost_equal(res, tgt)
-class TestDerivative(TestCase):
+class TestDerivative(object):
def test_chebder(self):
# check exceptions
@@ -345,7 +346,7 @@ class TestDerivative(TestCase):
assert_almost_equal(res, tgt)
-class TestVander(TestCase):
+class TestVander(object):
# some random values in [-1, 1)
x = np.random.random((3, 5))*2 - 1
@@ -393,7 +394,7 @@ class TestVander(TestCase):
assert_(van.shape == (1, 5, 24))
-class TestFitting(TestCase):
+class TestFitting(object):
def test_chebfit(self):
def f(x):
@@ -470,7 +471,7 @@ class TestFitting(TestCase):
assert_almost_equal(coef1, coef2)
-class TestCompanion(TestCase):
+class TestCompanion(object):
def test_raises(self):
assert_raises(ValueError, cheb.chebcompanion, [])
@@ -485,7 +486,7 @@ class TestCompanion(TestCase):
assert_(cheb.chebcompanion([1, 2])[0, 0] == -.5)
-class TestGauss(TestCase):
+class TestGauss(object):
def test_100(self):
x, w = cheb.chebgauss(100)
@@ -504,7 +505,7 @@ class TestGauss(TestCase):
assert_almost_equal(w.sum(), tgt)
-class TestMisc(TestCase):
+class TestMisc(object):
def test_chebfromroots(self):
res = cheb.chebfromroots([])
diff --git a/numpy/polynomial/tests/test_hermite.py b/numpy/polynomial/tests/test_hermite.py
index 06ce46ae4..2e39d854d 100644
--- a/numpy/polynomial/tests/test_hermite.py
+++ b/numpy/polynomial/tests/test_hermite.py
@@ -7,8 +7,9 @@ import numpy as np
import numpy.polynomial.hermite as herm
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
- TestCase, assert_almost_equal, assert_raises,
- assert_equal, assert_, run_module_suite)
+ assert_almost_equal, assert_raises, assert_equal, assert_,
+ run_module_suite
+ )
H0 = np.array([1])
H1 = np.array([0, 2])
@@ -28,7 +29,7 @@ def trim(x):
return herm.hermtrim(x, tol=1e-6)
-class TestConstants(TestCase):
+class TestConstants(object):
def test_hermdomain(self):
assert_equal(herm.hermdomain, [-1, 1])
@@ -43,7 +44,7 @@ class TestConstants(TestCase):
assert_equal(herm.hermx, [0, .5])
-class TestArithmetic(TestCase):
+class TestArithmetic(object):
x = np.linspace(-3, 3, 100)
def test_hermadd(self):
@@ -100,7 +101,7 @@ class TestArithmetic(TestCase):
assert_equal(trim(res), trim(tgt), err_msg=msg)
-class TestEvaluation(TestCase):
+class TestEvaluation(object):
# coefficients of 1 + 2*x + 3*x**2
c1d = np.array([2.5, 1., .75])
c2d = np.einsum('i,j->ij', c1d, c1d)
@@ -194,7 +195,7 @@ class TestEvaluation(TestCase):
assert_(res.shape == (2, 3)*3)
-class TestIntegral(TestCase):
+class TestIntegral(object):
def test_hermint(self):
# check exceptions
@@ -293,7 +294,7 @@ class TestIntegral(TestCase):
assert_almost_equal(res, tgt)
-class TestDerivative(TestCase):
+class TestDerivative(object):
def test_hermder(self):
# check exceptions
@@ -333,7 +334,7 @@ class TestDerivative(TestCase):
assert_almost_equal(res, tgt)
-class TestVander(TestCase):
+class TestVander(object):
# some random values in [-1, 1)
x = np.random.random((3, 5))*2 - 1
@@ -381,7 +382,7 @@ class TestVander(TestCase):
assert_(van.shape == (1, 5, 24))
-class TestFitting(TestCase):
+class TestFitting(object):
def test_hermfit(self):
def f(x):
@@ -458,7 +459,7 @@ class TestFitting(TestCase):
assert_almost_equal(coef1, coef2)
-class TestCompanion(TestCase):
+class TestCompanion(object):
def test_raises(self):
assert_raises(ValueError, herm.hermcompanion, [])
@@ -473,7 +474,7 @@ class TestCompanion(TestCase):
assert_(herm.hermcompanion([1, 2])[0, 0] == -.25)
-class TestGauss(TestCase):
+class TestGauss(object):
def test_100(self):
x, w = herm.hermgauss(100)
@@ -492,7 +493,7 @@ class TestGauss(TestCase):
assert_almost_equal(w.sum(), tgt)
-class TestMisc(TestCase):
+class TestMisc(object):
def test_hermfromroots(self):
res = herm.hermfromroots([])
diff --git a/numpy/polynomial/tests/test_hermite_e.py b/numpy/polynomial/tests/test_hermite_e.py
index 38da325f6..a81910787 100644
--- a/numpy/polynomial/tests/test_hermite_e.py
+++ b/numpy/polynomial/tests/test_hermite_e.py
@@ -7,8 +7,9 @@ import numpy as np
import numpy.polynomial.hermite_e as herme
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
- TestCase, assert_almost_equal, assert_raises,
- assert_equal, assert_, run_module_suite)
+ assert_almost_equal, assert_raises, assert_equal, assert_,
+ run_module_suite
+ )
He0 = np.array([1])
He1 = np.array([0, 1])
@@ -28,7 +29,7 @@ def trim(x):
return herme.hermetrim(x, tol=1e-6)
-class TestConstants(TestCase):
+class TestConstants(object):
def test_hermedomain(self):
assert_equal(herme.hermedomain, [-1, 1])
@@ -43,7 +44,7 @@ class TestConstants(TestCase):
assert_equal(herme.hermex, [0, 1])
-class TestArithmetic(TestCase):
+class TestArithmetic(object):
x = np.linspace(-3, 3, 100)
def test_hermeadd(self):
@@ -100,7 +101,7 @@ class TestArithmetic(TestCase):
assert_equal(trim(res), trim(tgt), err_msg=msg)
-class TestEvaluation(TestCase):
+class TestEvaluation(object):
# coefficients of 1 + 2*x + 3*x**2
c1d = np.array([4., 2., 3.])
c2d = np.einsum('i,j->ij', c1d, c1d)
@@ -194,7 +195,7 @@ class TestEvaluation(TestCase):
assert_(res.shape == (2, 3)*3)
-class TestIntegral(TestCase):
+class TestIntegral(object):
def test_hermeint(self):
# check exceptions
@@ -293,7 +294,7 @@ class TestIntegral(TestCase):
assert_almost_equal(res, tgt)
-class TestDerivative(TestCase):
+class TestDerivative(object):
def test_hermeder(self):
# check exceptions
@@ -334,7 +335,7 @@ class TestDerivative(TestCase):
assert_almost_equal(res, tgt)
-class TestVander(TestCase):
+class TestVander(object):
# some random values in [-1, 1)
x = np.random.random((3, 5))*2 - 1
@@ -382,7 +383,7 @@ class TestVander(TestCase):
assert_(van.shape == (1, 5, 24))
-class TestFitting(TestCase):
+class TestFitting(object):
def test_hermefit(self):
def f(x):
@@ -459,7 +460,7 @@ class TestFitting(TestCase):
assert_almost_equal(coef1, coef2)
-class TestCompanion(TestCase):
+class TestCompanion(object):
def test_raises(self):
assert_raises(ValueError, herme.hermecompanion, [])
@@ -474,7 +475,7 @@ class TestCompanion(TestCase):
assert_(herme.hermecompanion([1, 2])[0, 0] == -.5)
-class TestGauss(TestCase):
+class TestGauss(object):
def test_100(self):
x, w = herme.hermegauss(100)
@@ -493,7 +494,7 @@ class TestGauss(TestCase):
assert_almost_equal(w.sum(), tgt)
-class TestMisc(TestCase):
+class TestMisc(object):
def test_hermefromroots(self):
res = herme.hermefromroots([])
diff --git a/numpy/polynomial/tests/test_laguerre.py b/numpy/polynomial/tests/test_laguerre.py
index 0fa76b48a..17a3f7558 100644
--- a/numpy/polynomial/tests/test_laguerre.py
+++ b/numpy/polynomial/tests/test_laguerre.py
@@ -7,8 +7,9 @@ import numpy as np
import numpy.polynomial.laguerre as lag
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
- TestCase, assert_almost_equal, assert_raises,
- assert_equal, assert_, run_module_suite)
+ assert_almost_equal, assert_raises, assert_equal, assert_,
+ run_module_suite
+ )
L0 = np.array([1])/1
L1 = np.array([1, -1])/1
@@ -25,7 +26,7 @@ def trim(x):
return lag.lagtrim(x, tol=1e-6)
-class TestConstants(TestCase):
+class TestConstants(object):
def test_lagdomain(self):
assert_equal(lag.lagdomain, [0, 1])
@@ -40,7 +41,7 @@ class TestConstants(TestCase):
assert_equal(lag.lagx, [1, -1])
-class TestArithmetic(TestCase):
+class TestArithmetic(object):
x = np.linspace(-3, 3, 100)
def test_lagadd(self):
@@ -97,7 +98,7 @@ class TestArithmetic(TestCase):
assert_almost_equal(trim(res), trim(tgt), err_msg=msg)
-class TestEvaluation(TestCase):
+class TestEvaluation(object):
# coefficients of 1 + 2*x + 3*x**2
c1d = np.array([9., -14., 6.])
c2d = np.einsum('i,j->ij', c1d, c1d)
@@ -191,7 +192,7 @@ class TestEvaluation(TestCase):
assert_(res.shape == (2, 3)*3)
-class TestIntegral(TestCase):
+class TestIntegral(object):
def test_lagint(self):
# check exceptions
@@ -290,7 +291,7 @@ class TestIntegral(TestCase):
assert_almost_equal(res, tgt)
-class TestDerivative(TestCase):
+class TestDerivative(object):
def test_lagder(self):
# check exceptions
@@ -330,7 +331,7 @@ class TestDerivative(TestCase):
assert_almost_equal(res, tgt)
-class TestVander(TestCase):
+class TestVander(object):
# some random values in [-1, 1)
x = np.random.random((3, 5))*2 - 1
@@ -378,7 +379,7 @@ class TestVander(TestCase):
assert_(van.shape == (1, 5, 24))
-class TestFitting(TestCase):
+class TestFitting(object):
def test_lagfit(self):
def f(x):
@@ -440,7 +441,7 @@ class TestFitting(TestCase):
assert_almost_equal(lag.lagfit(x, x, [0, 1]), [1, -1])
-class TestCompanion(TestCase):
+class TestCompanion(object):
def test_raises(self):
assert_raises(ValueError, lag.lagcompanion, [])
@@ -455,7 +456,7 @@ class TestCompanion(TestCase):
assert_(lag.lagcompanion([1, 2])[0, 0] == 1.5)
-class TestGauss(TestCase):
+class TestGauss(object):
def test_100(self):
x, w = lag.laggauss(100)
@@ -474,7 +475,7 @@ class TestGauss(TestCase):
assert_almost_equal(w.sum(), tgt)
-class TestMisc(TestCase):
+class TestMisc(object):
def test_lagfromroots(self):
res = lag.lagfromroots([])
diff --git a/numpy/polynomial/tests/test_legendre.py b/numpy/polynomial/tests/test_legendre.py
index 485bc9688..375f41d49 100644
--- a/numpy/polynomial/tests/test_legendre.py
+++ b/numpy/polynomial/tests/test_legendre.py
@@ -7,8 +7,9 @@ import numpy as np
import numpy.polynomial.legendre as leg
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
- TestCase, assert_almost_equal, assert_raises,
- assert_equal, assert_, run_module_suite)
+ assert_almost_equal, assert_raises, assert_equal, assert_,
+ run_module_suite
+ )
L0 = np.array([1])
L1 = np.array([0, 1])
@@ -28,7 +29,7 @@ def trim(x):
return leg.legtrim(x, tol=1e-6)
-class TestConstants(TestCase):
+class TestConstants(object):
def test_legdomain(self):
assert_equal(leg.legdomain, [-1, 1])
@@ -43,7 +44,7 @@ class TestConstants(TestCase):
assert_equal(leg.legx, [0, 1])
-class TestArithmetic(TestCase):
+class TestArithmetic(object):
x = np.linspace(-1, 1, 100)
def test_legadd(self):
@@ -101,7 +102,7 @@ class TestArithmetic(TestCase):
assert_equal(trim(res), trim(tgt), err_msg=msg)
-class TestEvaluation(TestCase):
+class TestEvaluation(object):
# coefficients of 1 + 2*x + 3*x**2
c1d = np.array([2., 2., 2.])
c2d = np.einsum('i,j->ij', c1d, c1d)
@@ -195,7 +196,7 @@ class TestEvaluation(TestCase):
assert_(res.shape == (2, 3)*3)
-class TestIntegral(TestCase):
+class TestIntegral(object):
def test_legint(self):
# check exceptions
@@ -294,7 +295,7 @@ class TestIntegral(TestCase):
assert_almost_equal(res, tgt)
-class TestDerivative(TestCase):
+class TestDerivative(object):
def test_legder(self):
# check exceptions
@@ -334,7 +335,7 @@ class TestDerivative(TestCase):
assert_almost_equal(res, tgt)
-class TestVander(TestCase):
+class TestVander(object):
# some random values in [-1, 1)
x = np.random.random((3, 5))*2 - 1
@@ -382,7 +383,7 @@ class TestVander(TestCase):
assert_(van.shape == (1, 5, 24))
-class TestFitting(TestCase):
+class TestFitting(object):
def test_legfit(self):
def f(x):
@@ -459,7 +460,7 @@ class TestFitting(TestCase):
assert_almost_equal(coef1, coef2)
-class TestCompanion(TestCase):
+class TestCompanion(object):
def test_raises(self):
assert_raises(ValueError, leg.legcompanion, [])
@@ -474,7 +475,7 @@ class TestCompanion(TestCase):
assert_(leg.legcompanion([1, 2])[0, 0] == -.5)
-class TestGauss(TestCase):
+class TestGauss(object):
def test_100(self):
x, w = leg.leggauss(100)
@@ -493,7 +494,7 @@ class TestGauss(TestCase):
assert_almost_equal(w.sum(), tgt)
-class TestMisc(TestCase):
+class TestMisc(object):
def test_legfromroots(self):
res = leg.legfromroots([])
diff --git a/numpy/polynomial/tests/test_polynomial.py b/numpy/polynomial/tests/test_polynomial.py
index 037be5927..bf6c5e814 100644
--- a/numpy/polynomial/tests/test_polynomial.py
+++ b/numpy/polynomial/tests/test_polynomial.py
@@ -6,8 +6,9 @@ from __future__ import division, absolute_import, print_function
import numpy as np
import numpy.polynomial.polynomial as poly
from numpy.testing import (
- TestCase, assert_almost_equal, assert_raises,
- assert_equal, assert_, run_module_suite)
+ assert_almost_equal, assert_raises, assert_equal, assert_,
+ run_module_suite
+ )
def trim(x):
@@ -27,7 +28,7 @@ T9 = [0, 9, 0, -120, 0, 432, 0, -576, 0, 256]
Tlist = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
-class TestConstants(TestCase):
+class TestConstants(object):
def test_polydomain(self):
assert_equal(poly.polydomain, [-1, 1])
@@ -42,7 +43,7 @@ class TestConstants(TestCase):
assert_equal(poly.polyx, [0, 1])
-class TestArithmetic(TestCase):
+class TestArithmetic(object):
def test_polyadd(self):
for i in range(5):
@@ -103,7 +104,7 @@ class TestArithmetic(TestCase):
assert_equal(res, tgt, err_msg=msg)
-class TestEvaluation(TestCase):
+class TestEvaluation(object):
# coefficients of 1 + 2*x + 3*x**2
c1d = np.array([1., 2., 3.])
c2d = np.einsum('i,j->ij', c1d, c1d)
@@ -263,7 +264,7 @@ class TestEvaluation(TestCase):
assert_(res.shape == (2, 3)*3)
-class TestIntegral(TestCase):
+class TestIntegral(object):
def test_polyint(self):
# check exceptions
@@ -357,7 +358,7 @@ class TestIntegral(TestCase):
assert_almost_equal(res, tgt)
-class TestDerivative(TestCase):
+class TestDerivative(object):
def test_polyder(self):
# check exceptions
@@ -397,7 +398,7 @@ class TestDerivative(TestCase):
assert_almost_equal(res, tgt)
-class TestVander(TestCase):
+class TestVander(object):
# some random values in [-1, 1)
x = np.random.random((3, 5))*2 - 1
@@ -445,7 +446,7 @@ class TestVander(TestCase):
assert_(van.shape == (1, 5, 24))
-class TestCompanion(TestCase):
+class TestCompanion(object):
def test_raises(self):
assert_raises(ValueError, poly.polycompanion, [])
@@ -460,7 +461,7 @@ class TestCompanion(TestCase):
assert_(poly.polycompanion([1, 2])[0, 0] == -.5)
-class TestMisc(TestCase):
+class TestMisc(object):
def test_polyfromroots(self):
res = poly.polyfromroots([])
diff --git a/numpy/polynomial/tests/test_polyutils.py b/numpy/polynomial/tests/test_polyutils.py
index 974e2e09a..bd1cb2008 100644
--- a/numpy/polynomial/tests/test_polyutils.py
+++ b/numpy/polynomial/tests/test_polyutils.py
@@ -6,11 +6,12 @@ from __future__ import division, absolute_import, print_function
import numpy as np
import numpy.polynomial.polyutils as pu
from numpy.testing import (
- TestCase, assert_almost_equal, assert_raises,
- assert_equal, assert_, run_module_suite)
+ assert_almost_equal, assert_raises, assert_equal, assert_,
+ run_module_suite
+ )
-class TestMisc(TestCase):
+class TestMisc(object):
def test_trimseq(self):
for i in range(5):
@@ -43,7 +44,7 @@ class TestMisc(TestCase):
assert_equal(pu.trimcoef(coef, 2), [0])
-class TestDomain(TestCase):
+class TestDomain(object):
def test_getdomain(self):
# test for real values
diff --git a/numpy/polynomial/tests/test_printing.py b/numpy/polynomial/tests/test_printing.py
index 86cd25732..52604c080 100644
--- a/numpy/polynomial/tests/test_printing.py
+++ b/numpy/polynomial/tests/test_printing.py
@@ -1,10 +1,10 @@
from __future__ import division, absolute_import, print_function
import numpy.polynomial as poly
-from numpy.testing import TestCase, run_module_suite, assert_
+from numpy.testing import run_module_suite, assert_
-class test_str(TestCase):
+class TestStr(object):
def test_polynomial_str(self):
res = str(poly.Polynomial([0, 1]))
tgt = 'poly([0., 1.])'
@@ -36,7 +36,7 @@ class test_str(TestCase):
assert_(res, tgt)
-class test_repr(TestCase):
+class TestRepr(object):
def test_polynomial_str(self):
res = repr(poly.Polynomial([0, 1]))
tgt = 'Polynomial([0., 1.])'