"Fossies" - the Fresh Open Source Software Archive

Member "numpy-1.16.4/numpy/polynomial/tests/test_printing.py" (22 Feb 2019, 2067 Bytes) of package /linux/misc/numpy-1.16.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 from __future__ import division, absolute_import, print_function
    2 
    3 import numpy.polynomial as poly
    4 from numpy.testing import assert_equal
    5 
    6 
    7 class TestStr(object):
    8     def test_polynomial_str(self):
    9         res = str(poly.Polynomial([0, 1]))
   10         tgt = 'poly([0. 1.])'
   11         assert_equal(res, tgt)
   12 
   13     def test_chebyshev_str(self):
   14         res = str(poly.Chebyshev([0, 1]))
   15         tgt = 'cheb([0. 1.])'
   16         assert_equal(res, tgt)
   17 
   18     def test_legendre_str(self):
   19         res = str(poly.Legendre([0, 1]))
   20         tgt = 'leg([0. 1.])'
   21         assert_equal(res, tgt)
   22 
   23     def test_hermite_str(self):
   24         res = str(poly.Hermite([0, 1]))
   25         tgt = 'herm([0. 1.])'
   26         assert_equal(res, tgt)
   27 
   28     def test_hermiteE_str(self):
   29         res = str(poly.HermiteE([0, 1]))
   30         tgt = 'herme([0. 1.])'
   31         assert_equal(res, tgt)
   32 
   33     def test_laguerre_str(self):
   34         res = str(poly.Laguerre([0, 1]))
   35         tgt = 'lag([0. 1.])'
   36         assert_equal(res, tgt)
   37 
   38 
   39 class TestRepr(object):
   40     def test_polynomial_str(self):
   41         res = repr(poly.Polynomial([0, 1]))
   42         tgt = 'Polynomial([0., 1.], domain=[-1,  1], window=[-1,  1])'
   43         assert_equal(res, tgt)
   44 
   45     def test_chebyshev_str(self):
   46         res = repr(poly.Chebyshev([0, 1]))
   47         tgt = 'Chebyshev([0., 1.], domain=[-1,  1], window=[-1,  1])'
   48         assert_equal(res, tgt)
   49 
   50     def test_legendre_repr(self):
   51         res = repr(poly.Legendre([0, 1]))
   52         tgt = 'Legendre([0., 1.], domain=[-1,  1], window=[-1,  1])'
   53         assert_equal(res, tgt)
   54 
   55     def test_hermite_repr(self):
   56         res = repr(poly.Hermite([0, 1]))
   57         tgt = 'Hermite([0., 1.], domain=[-1,  1], window=[-1,  1])'
   58         assert_equal(res, tgt)
   59 
   60     def test_hermiteE_repr(self):
   61         res = repr(poly.HermiteE([0, 1]))
   62         tgt = 'HermiteE([0., 1.], domain=[-1,  1], window=[-1,  1])'
   63         assert_equal(res, tgt)
   64 
   65     def test_laguerre_repr(self):
   66         res = repr(poly.Laguerre([0, 1]))
   67         tgt = 'Laguerre([0., 1.], domain=[0, 1], window=[0, 1])'
   68         assert_equal(res, tgt)