summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_io.py
diff options
context:
space:
mode:
authorpierregm <pierregm@localhost>2009-01-26 21:04:26 +0000
committerpierregm <pierregm@localhost>2009-01-26 21:04:26 +0000
commit2e346ec1e1000c11f484708e2997b7b95808a00d (patch)
treeed452e940d6c9f7e00976604acd887bdfb529d70 /numpy/lib/tests/test_io.py
parent9ac9630d805fd4ec235e009782f019fa8d8e8fa9 (diff)
downloadnumpy-2e346ec1e1000c11f484708e2997b7b95808a00d.tar.gz
* _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)
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r--numpy/lib/tests/test_io.py17
1 files changed, 17 insertions, 0 deletions
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')