From 955f471ed5034f772fa1eb1a86429a79e53ff541 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Mon, 20 Feb 2012 22:20:48 +0100 Subject: TST: filter RuntimeWarnings for invalids from some more test files. This should fix the test errors seen on both MinGW and MSVC9 related to this. --- numpy/lib/tests/test_function_base.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'numpy/lib/tests/test_function_base.py') diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index fc033b164..a7d501c52 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -784,14 +784,18 @@ class TestHistogramdd(TestCase): def test_inf_edges(self): """Test using +/-inf bin edges works. See #1788.""" - x = np.arange(6).reshape(3, 2) - expected = np.array([[1, 0], [0, 1], [0, 1]]) - h, e = np.histogramdd(x, bins=[3, [-np.inf, 2, 10]]) - assert_allclose(h, expected) - h, e = np.histogramdd(x, bins=[3, np.array([-1, 2, np.inf])]) - assert_allclose(h, expected) - h, e = np.histogramdd(x, bins=[3, [-np.inf, 3, np.inf]]) - assert_allclose(h, expected) + olderr = np.seterr(invalid='ignore') + try: + x = np.arange(6).reshape(3, 2) + expected = np.array([[1, 0], [0, 1], [0, 1]]) + h, e = np.histogramdd(x, bins=[3, [-np.inf, 2, 10]]) + assert_allclose(h, expected) + h, e = np.histogramdd(x, bins=[3, np.array([-1, 2, np.inf])]) + assert_allclose(h, expected) + h, e = np.histogramdd(x, bins=[3, [-np.inf, 3, np.inf]]) + assert_allclose(h, expected) + finally: + np.seterr(**olderr) class TestUnique(TestCase): -- cgit v1.2.1