From f2d742c06fd013a013c811593257b67502ea9486 Mon Sep 17 00:00:00 2001 From: Mario Mulansky Date: Mon, 19 Jan 2015 23:07:09 +0100 Subject: fixed bug for multiple intervals --- test/test_function.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test') 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() -- cgit v1.2.3