diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/polynomial/_polybase.py | 2 | ||||
-rw-r--r-- | numpy/polynomial/chebyshev.py | 4 | ||||
-rw-r--r-- | numpy/polynomial/legendre.py | 6 | ||||
-rw-r--r-- | numpy/polynomial/tests/test_printing.py | 50 |
4 files changed, 31 insertions, 31 deletions
diff --git a/numpy/polynomial/_polybase.py b/numpy/polynomial/_polybase.py index 96ca20836..78392d2a2 100644 --- a/numpy/polynomial/_polybase.py +++ b/numpy/polynomial/_polybase.py @@ -260,7 +260,7 @@ class ABCPolyBase(object): self.window = window def __repr__(self): - format = "%s(%s, %s, %s)" + format = "%s(%s, domain=%s, window=%s)" coef = repr(self.coef)[6:-1] domain = repr(self.domain)[6:-1] window = repr(self.window)[6:-1] diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py index dbf380991..b28ea0462 100644 --- a/numpy/polynomial/chebyshev.py +++ b/numpy/polynomial/chebyshev.py @@ -361,10 +361,10 @@ def poly2cheb(pol): >>> from numpy import polynomial as P >>> p = P.Polynomial(range(4)) >>> p - Polynomial([ 0., 1., 2., 3.], [-1., 1.]) + Polynomial([ 0., 1., 2., 3.], domain=[-1, 1], window=[-1, 1]) >>> c = p.convert(kind=P.Chebyshev) >>> c - Chebyshev([ 1. , 3.25, 1. , 0.75], [-1., 1.]) + Chebyshev([ 1. , 3.25, 1. , 0.75], domain=[-1, 1], window=[-1, 1]) >>> P.poly2cheb(range(4)) array([ 1. , 3.25, 1. , 0.75]) diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py index 5a263ef89..d4b4dd130 100644 --- a/numpy/polynomial/legendre.py +++ b/numpy/polynomial/legendre.py @@ -136,10 +136,10 @@ def poly2leg(pol): >>> from numpy import polynomial as P >>> p = P.Polynomial(np.arange(4)) >>> p - Polynomial([ 0., 1., 2., 3.], [-1., 1.]) - >>> c = P.Legendre(P.poly2leg(p.coef)) + Polynomial([ 0., 1., 2., 3.], domain=[-1, 1], window=[-1, 1]) + >>> c = P.Legendre(P.legendre.poly2leg(p.coef)) >>> c - Legendre([ 1. , 3.25, 1. , 0.75], [-1., 1.]) + Legendre([ 1. , 3.25, 1. , 0.75], domain=[-1, 1], window=[-1, 1]) """ [pol] = pu.as_series([pol]) diff --git a/numpy/polynomial/tests/test_printing.py b/numpy/polynomial/tests/test_printing.py index 52604c080..f403812c9 100644 --- a/numpy/polynomial/tests/test_printing.py +++ b/numpy/polynomial/tests/test_printing.py @@ -1,71 +1,71 @@ from __future__ import division, absolute_import, print_function import numpy.polynomial as poly -from numpy.testing import run_module_suite, assert_ +from numpy.testing import run_module_suite, assert_equal class TestStr(object): def test_polynomial_str(self): res = str(poly.Polynomial([0, 1])) - tgt = 'poly([0., 1.])' - assert_(res, tgt) + tgt = 'poly([ 0. 1.])' + assert_equal(res, tgt) def test_chebyshev_str(self): res = str(poly.Chebyshev([0, 1])) - tgt = 'leg([0., 1.])' - assert_(res, tgt) + tgt = 'cheb([ 0. 1.])' + assert_equal(res, tgt) def test_legendre_str(self): res = str(poly.Legendre([0, 1])) - tgt = 'leg([0., 1.])' - assert_(res, tgt) + tgt = 'leg([ 0. 1.])' + assert_equal(res, tgt) def test_hermite_str(self): res = str(poly.Hermite([0, 1])) - tgt = 'herm([0., 1.])' - assert_(res, tgt) + tgt = 'herm([ 0. 1.])' + assert_equal(res, tgt) def test_hermiteE_str(self): res = str(poly.HermiteE([0, 1])) - tgt = 'herme([0., 1.])' - assert_(res, tgt) + tgt = 'herme([ 0. 1.])' + assert_equal(res, tgt) def test_laguerre_str(self): res = str(poly.Laguerre([0, 1])) - tgt = 'lag([0., 1.])' - assert_(res, tgt) + tgt = 'lag([ 0. 1.])' + assert_equal(res, tgt) class TestRepr(object): def test_polynomial_str(self): res = repr(poly.Polynomial([0, 1])) - tgt = 'Polynomial([0., 1.])' - assert_(res, tgt) + tgt = 'Polynomial([ 0., 1.], domain=[-1, 1], window=[-1, 1])' + assert_equal(res, tgt) def test_chebyshev_str(self): res = repr(poly.Chebyshev([0, 1])) - tgt = 'Chebyshev([0., 1.], [-1., 1.], [-1., 1.])' - assert_(res, tgt) + tgt = 'Chebyshev([ 0., 1.], domain=[-1, 1], window=[-1, 1])' + assert_equal(res, tgt) def test_legendre_repr(self): res = repr(poly.Legendre([0, 1])) - tgt = 'Legendre([0., 1.], [-1., 1.], [-1., 1.])' - assert_(res, tgt) + tgt = 'Legendre([ 0., 1.], domain=[-1, 1], window=[-1, 1])' + assert_equal(res, tgt) def test_hermite_repr(self): res = repr(poly.Hermite([0, 1])) - tgt = 'Hermite([0., 1.], [-1., 1.], [-1., 1.])' - assert_(res, tgt) + tgt = 'Hermite([ 0., 1.], domain=[-1, 1], window=[-1, 1])' + assert_equal(res, tgt) def test_hermiteE_repr(self): res = repr(poly.HermiteE([0, 1])) - tgt = 'HermiteE([0., 1.], [-1., 1.], [-1., 1.])' - assert_(res, tgt) + tgt = 'HermiteE([ 0., 1.], domain=[-1, 1], window=[-1, 1])' + assert_equal(res, tgt) def test_laguerre_repr(self): res = repr(poly.Laguerre([0, 1])) - tgt = 'Laguerre([0., 1.], [0., 1.], [0., 1.])' - assert_(res, tgt) + tgt = 'Laguerre([ 0., 1.], domain=[0, 1], window=[0, 1])' + assert_equal(res, tgt) # |