diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2007-08-06 12:42:58 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2007-08-06 12:42:58 +0000 |
commit | 5d4824522b29ac83d08d208723cba56ece1d6ea5 (patch) | |
tree | 2f8c9ef596b8321bbb4f65ce5d1807739d9db3ce /numpy/lib/tests | |
parent | 7a605b4d18a7d5283c5c3eb31b9258150e5755c5 (diff) | |
download | numpy-5d4824522b29ac83d08d208723cba56ece1d6ea5.tar.gz |
Fix string conversion of polynomial when leading coefficients are
zero. Closes ticket #564.
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_polynomial.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_polynomial.py b/numpy/lib/tests/test_polynomial.py index f3a8720d9..d7c2c917d 100644 --- a/numpy/lib/tests/test_polynomial.py +++ b/numpy/lib/tests/test_polynomial.py @@ -82,5 +82,17 @@ class test_docs(NumpyTestCase): def check_roots(self): assert_array_equal(N.roots([1,0,0]), [0,0]) + def check_str_leading_zeros(self): + p = N.poly1d([4,3,2,1]) + p[3] = 0 + assert_equal(str(p), + " 2\n" + "3 x + 2 x + 1") + + p = N.poly1d([1,2]) + p[0] = 0 + p[1] = 0 + assert_equal(str(p), " \n0") + if __name__ == "__main__": NumpyTest().run() |