From e962f6b0be32515d6a1d9fb25d24ca250d632a4c Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Tue, 21 Feb 2012 22:43:21 +0100 Subject: TST: filter one more printed warning. This one wasn't actually converted to a test error, because it's not a RuntimeWarning. Maybe need to add an option to raise on UserWarning too. --- numpy/lib/tests/test_io.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'numpy/lib/tests/test_io.py') diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index 949d8fb45..41a95de10 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -586,9 +586,18 @@ class TestLoadTxt(TestCase): e.seek(0) x = np.loadtxt(e, dtype=int, delimiter=',', ndmin=0) assert_(x.shape == (3,)) - f = StringIO() - assert_(np.loadtxt(f, ndmin=2).shape == (0, 1,)) - assert_(np.loadtxt(f, ndmin=1).shape == (0,)) + + # Test ndmin kw with empty file. + warn_ctx = WarningManager() + warn_ctx.__enter__() + try: + warnings.filterwarnings("ignore", + message="loadtxt: Empty input file:") + f = StringIO() + assert_(np.loadtxt(f, ndmin=2).shape == (0, 1,)) + assert_(np.loadtxt(f, ndmin=1).shape == (0,)) + finally: + warn_ctx.__exit__() def test_generator_source(self): def count(): -- cgit v1.2.1