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