summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2009-03-09 01:00:12 +0000
committerCharles Harris <charlesr.harris@gmail.com>2009-03-09 01:00:12 +0000
commit4a632534604d686ff9ac5a9629ce06f7c895cd1e (patch)
treeffad618c34abb2aa0a2dfae19924101b4371a870 /numpy
parent3926a6c68334efd6334f998cfa03cf18a152a46f (diff)
downloadnumpy-4a632534604d686ff9ac5a9629ce06f7c895cd1e.tar.gz
Fix ticket #944.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/lib/polynomial.py4
-rw-r--r--numpy/lib/tests/test_regression.py11
2 files changed, 10 insertions, 5 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py
index 504a1271f..ec9b8c1f6 100644
--- a/numpy/lib/polynomial.py
+++ b/numpy/lib/polynomial.py
@@ -244,10 +244,10 @@ def polyint(p, m=1, k=None):
else:
truepoly = isinstance(p, poly1d)
p = NX.asarray(p)
- y = NX.zeros(len(p)+1, float)
+ y = NX.zeros(len(p) + 1, p.dtype)
y[:-1] = p*1.0/NX.arange(len(p), 0, -1)
y[-1] = k[0]
- val = polyint(y, m-1, k=k[1:])
+ val = polyint(y, m - 1, k=k[1:])
if truepoly:
val = poly1d(val)
return val
diff --git a/numpy/lib/tests/test_regression.py b/numpy/lib/tests/test_regression.py
index 189b2e481..e465dc4b6 100644
--- a/numpy/lib/tests/test_regression.py
+++ b/numpy/lib/tests/test_regression.py
@@ -1,10 +1,9 @@
from numpy.testing import *
import numpy as np
-rlevel = 1
-class TestRegression(TestCase):
- def test_polyfit_build(self,level=rlevel):
+class TestRegression(object):
+ def test_polyfit_build(self):
"""Ticket #628"""
ref = [-1.06123820e-06, 5.70886914e-04, -1.13822012e-01,
9.95368241e+00, -3.14526520e+02]
@@ -25,6 +24,12 @@ class TestRegression(TestCase):
tested = np.polyfit(x, y, 4)
assert_array_almost_equal(ref, tested)
+ def test_polyint_type(self) :
+ """Ticket #944"""
+ msg = "Wrong type, should be complex"
+ x = np.polyint(np.ones(3, dtype=np.complex))
+ assert_(np.asarray(x).dtype == np.complex, msg)
+
if __name__ == "__main__":
run_module_suite()