From 911e94dd0a64adae9fb2057fb0210e512a9b7d4a Mon Sep 17 00:00:00 2001 From: pierregm Date: Thu, 5 Feb 2009 04:31:51 +0000 Subject: * genfromtxt : Fixed when a dtype involving objects is explicitly given. Raise a NotImplementedError if the dtype is nested. * _iotools : make sure StringConverter gets properly initiated when a function returning a np.object is used as input parameter. --- numpy/lib/tests/test__iotools.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'numpy/lib/tests/test__iotools.py') diff --git a/numpy/lib/tests/test__iotools.py b/numpy/lib/tests/test__iotools.py index 61b069659..bb1483186 100644 --- a/numpy/lib/tests/test__iotools.py +++ b/numpy/lib/tests/test__iotools.py @@ -2,7 +2,8 @@ import StringIO import numpy as np -from numpy.lib._iotools import LineSplitter, NameValidator, StringConverter +from numpy.lib._iotools import LineSplitter, NameValidator, StringConverter,\ + has_nested_fields from numpy.testing import * class TestLineSplitter(TestCase): @@ -142,3 +143,17 @@ class TestStringConverter(TestCase): test = convert('') assert_equal(test, date(2000, 01, 01)) + +#------------------------------------------------------------------------------- + +class TestMiscFunctions(TestCase): + # + def test_has_nested_dtype(self): + "Test has_nested_dtype" + ndtype = np.dtype(np.float) + assert_equal(has_nested_fields(ndtype), False) + ndtype = np.dtype([('A', '|S3'), ('B', float)]) + assert_equal(has_nested_fields(ndtype), False) + ndtype = np.dtype([('A', int), ('B', [('BA', float), ('BB', '|S1')])]) + assert_equal(has_nested_fields(ndtype), True) + -- cgit v1.2.1