diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-04-15 13:36:03 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-15 13:36:03 -0600 |
commit | 18a068ea7a5fe76cda3977a55056fadef6668bbc (patch) | |
tree | 13cb5b8a16306f6a31e8ce378a8bf2cbc7a7765c /numpy/lib/tests | |
parent | caede96a766982e26fcdf92180310dcf1ec938ca (diff) | |
parent | 29405fdcc2545e8cf5227d019d5e5d4d8b28c032 (diff) | |
download | numpy-18a068ea7a5fe76cda3977a55056fadef6668bbc.tar.gz |
Merge pull request #10907 from mattip/test_polynomial-doctests
TST: reactivate module docstring tests, fix float formatting
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_polynomial.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/numpy/lib/tests/test_polynomial.py b/numpy/lib/tests/test_polynomial.py index 1d7b8cbac..7f6fca4a4 100644 --- a/numpy/lib/tests/test_polynomial.py +++ b/numpy/lib/tests/test_polynomial.py @@ -1,15 +1,13 @@ -from __future__ import division, absolute_import, print_function - ''' >>> p = np.poly1d([1.,2,3]) >>> p -poly1d([ 1., 2., 3.]) +poly1d([1., 2., 3.]) >>> print(p) 2 1 x + 2 x + 3 >>> q = np.poly1d([3.,2,1]) >>> q -poly1d([ 3., 2., 1.]) +poly1d([3., 2., 1.]) >>> print(q) 2 3 x + 2 x + 1 @@ -30,23 +28,23 @@ poly1d([ 3., 2., 1.]) 86.0 >>> p * q -poly1d([ 3., 8., 14., 8., 3.]) +poly1d([ 3., 8., 14., 8., 3.]) >>> p / q -(poly1d([ 0.33333333]), poly1d([ 1.33333333, 2.66666667])) +(poly1d([0.33333333]), poly1d([1.33333333, 2.66666667])) >>> p + q -poly1d([ 4., 4., 4.]) +poly1d([4., 4., 4.]) >>> p - q poly1d([-2., 0., 2.]) >>> p ** 4 -poly1d([ 1., 8., 36., 104., 214., 312., 324., 216., 81.]) +poly1d([ 1., 8., 36., 104., 214., 312., 324., 216., 81.]) >>> p(q) -poly1d([ 9., 12., 16., 8., 6.]) +poly1d([ 9., 12., 16., 8., 6.]) >>> q(p) -poly1d([ 3., 12., 32., 40., 34.]) +poly1d([ 3., 12., 32., 40., 34.]) >>> np.asarray(p) -array([ 1., 2., 3.]) +array([1., 2., 3.]) >>> len(p) 2 @@ -54,16 +52,16 @@ array([ 1., 2., 3.]) (3.0, 2.0, 1.0, 0) >>> p.integ() -poly1d([ 0.33333333, 1. , 3. , 0. ]) +poly1d([0.33333333, 1. , 3. , 0. ]) >>> p.integ(1) -poly1d([ 0.33333333, 1. , 3. , 0. ]) +poly1d([0.33333333, 1. , 3. , 0. ]) >>> p.integ(5) -poly1d([ 0.00039683, 0.00277778, 0.025 , 0. , 0. , - 0. , 0. , 0. ]) +poly1d([0.00039683, 0.00277778, 0.025 , 0. , 0. , + 0. , 0. , 0. ]) >>> p.deriv() -poly1d([ 2., 2.]) +poly1d([2., 2.]) >>> p.deriv(2) -poly1d([ 2.]) +poly1d([2.]) >>> q = np.poly1d([1.,2,3], variable='y') >>> print(q) @@ -75,9 +73,11 @@ poly1d([ 2.]) 1 lambda + 2 lambda + 3 >>> np.polydiv(np.poly1d([1,0,-1]), np.poly1d([1,1])) -(poly1d([ 1., -1.]), poly1d([ 0.])) +(poly1d([ 1., -1.]), poly1d([0.])) ''' +from __future__ import division, absolute_import, print_function + import numpy as np from numpy.testing import ( assert_, assert_equal, assert_array_equal, assert_almost_equal, |