From 2e346ec1e1000c11f484708e2997b7b95808a00d Mon Sep 17 00:00:00 2001 From: pierregm Date: Mon, 26 Jan 2009 21:04:26 +0000 Subject: * _iotools.StringConverter : - add a _checked attribute to indicate whether the converter has been upgraded or not. - switched the default value for bool to False * io.genfromtxt: - fixed for the case where a whole column is masked: switch to bool or the common dtype (if needed) --- numpy/lib/tests/test_io.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (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 f0f2a0619..2995d6709 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -685,6 +685,23 @@ M 33 21.99 assert_equal(test.mask, control.mask) + def test_with_masked_column_uniform(self): + "Test masked column" + data = StringIO.StringIO('1 2 3\n4 5 6\n') + test = np.genfromtxt(data, missing='2,5', dtype=None, usemask=True) + control = ma.array([[1, 2, 3], [4, 5, 6]], mask=[[0, 1, 0],[0, 1, 0]]) + assert_equal(test, control) + + def test_with_masked_column_various(self): + "Test masked column" + data = StringIO.StringIO('True 2 3\nFalse 5 6\n') + test = np.genfromtxt(data, missing='2,5', dtype=None, usemask=True) + control = ma.array([(1, 2, 3), (0, 5, 6)], + mask=[(0, 1, 0),(0, 1, 0)], + dtype=[('f0', bool), ('f1', bool), ('f2', int)]) + assert_equal(test, control) + + def test_recfromtxt(self): # data = StringIO.StringIO('A,B\n0,1\n2,3') -- cgit v1.2.1