summaryrefslogtreecommitdiff
path: root/numpy/polynomial/tests
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2010-05-21 05:36:13 +0000
committerCharles Harris <charlesr.harris@gmail.com>2010-05-21 05:36:13 +0000
commit082e86f7461f066f4a4e48191d44305f47860b55 (patch)
tree4739433d73ee41e6e23e31493abcef62a2d78f3f /numpy/polynomial/tests
parent467f4fb2fe54ad979dc6c4aa3a11e7482b97fd0f (diff)
downloadnumpy-082e86f7461f066f4a4e48191d44305f47860b55.tar.gz
CHG: Change the default domain for the fit class method of the
Chebyshev and Polynomial classes to None. Add 'default' as a possible value of the domain argument to specify the default domain. This change fits better with my experience with this method. I feel it is safe to make this change at this late date because the functions seem little used as yet and I would like to get them 'right' before folks catch on to their presence.
Diffstat (limited to 'numpy/polynomial/tests')
-rw-r--r--numpy/polynomial/tests/test_chebyshev.py6
-rw-r--r--numpy/polynomial/tests/test_polynomial.py6
2 files changed, 12 insertions, 0 deletions
diff --git a/numpy/polynomial/tests/test_chebyshev.py b/numpy/polynomial/tests/test_chebyshev.py
index 13776aa87..2278ca871 100644
--- a/numpy/polynomial/tests/test_chebyshev.py
+++ b/numpy/polynomial/tests/test_chebyshev.py
@@ -463,7 +463,13 @@ class TestChebyshevClass(TestCase) :
return x*(x - 1)*(x - 2)
x = np.linspace(0,3)
y = f(x)
+
+ # test default value of domain
p = ch.Chebyshev.fit(x, y, 3)
+ assert_almost_equal(p.domain, [0,3])
+
+ # test that fit works in given domains
+ p = ch.Chebyshev.fit(x, y, 3, 'default')
assert_almost_equal(p(x), y)
p = ch.Chebyshev.fit(x, y, 3, None)
assert_almost_equal(p(x), y)
diff --git a/numpy/polynomial/tests/test_polynomial.py b/numpy/polynomial/tests/test_polynomial.py
index 7ba5b6c8f..13718fe9e 100644
--- a/numpy/polynomial/tests/test_polynomial.py
+++ b/numpy/polynomial/tests/test_polynomial.py
@@ -434,7 +434,13 @@ class TestPolynomialClass(TestCase) :
return x*(x - 1)*(x - 2)
x = np.linspace(0,3)
y = f(x)
+
+ # test default value of domain
p = poly.Polynomial.fit(x, y, 3)
+ assert_almost_equal(p.domain, [0,3])
+
+ # test that fit works in given domains
+ p = poly.Polynomial.fit(x, y, 3, 'default')
assert_almost_equal(p(x), y)
p = poly.Polynomial.fit(x, y, 3, None)
assert_almost_equal(p(x), y)