summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_io.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@googlemail.com>2012-03-02 20:24:45 +0100
committerRalf Gommers <ralf.gommers@googlemail.com>2012-03-02 20:25:02 +0100
commitb9872b41422e33c9910829cd54268a510ec9436b (patch)
tree33168c591f5186f521bb1c21ae3de73642d7f0e1 /numpy/lib/tests/test_io.py
parentba40918d39c8e0c41a6bffac67d2d74dd335161f (diff)
parente962f6b0be32515d6a1d9fb25d24ca250d632a4c (diff)
downloadnumpy-b9872b41422e33c9910829cd54268a510ec9436b.tar.gz
Merge pull request #215 from rgommers/windows-runtime-warnings.
This PR fixes a number of warnings, that were converted to test errors in master. Some of them were only visible with MSVC.
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r--numpy/lib/tests/test_io.py15
1 files changed, 12 insertions, 3 deletions
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():