summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMario Mulansky <mario.mulansky@gmx.net>2015-01-19 23:07:09 +0100
committerMario Mulansky <mario.mulansky@gmx.net>2015-01-19 23:07:09 +0100
commitf2d742c06fd013a013c811593257b67502ea9486 (patch)
tree5d347cc4dc562e7389416cb6a0ce4a907c04a70e /test
parent6c0f966649c8dedd4115d6809e569732ee5709c9 (diff)
fixed bug for multiple intervals
Diffstat (limited to 'test')
-rw-r--r--test/test_function.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/test_function.py b/test/test_function.py
index da3d851..933fd2e 100644
--- a/test/test_function.py
+++ b/test/test_function.py
@@ -216,8 +216,7 @@ def test_df():
assert_array_almost_equal(xp, xp_expected, decimal=16)
assert_array_almost_equal(yp, yp_expected, decimal=16)
- avrg_expected = 2.0 / 5.0
- assert_almost_equal(f.avrg(), avrg_expected, decimal=16)
+ assert_almost_equal(f.avrg(), 2.0/5.0, decimal=16)
# interval averaging
a = f.avrg([0.5, 2.4])
@@ -229,6 +228,10 @@ def test_df():
a = f.avrg([1.1, 4.0])
assert_almost_equal(a, 1.0/3.0, decimal=16)
+ # averaging over multiple intervals
+ a = f.avrg([(0.5, 1.5), (1.5, 2.6)])
+ assert_almost_equal(a, 2.0/5.0, decimal=16)
+
if __name__ == "__main__":
test_pwc()