diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2008-04-25 07:24:51 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2008-04-25 07:24:51 +0000 |
commit | 954e1411c794fa570657f2614912468fe1eabe27 (patch) | |
tree | 8a5459083b85748b2b421ba3bc5d58fd8d9c4728 /numpy/core | |
parent | 9742ba43e617be68b9b68de5d886b03662b7db55 (diff) | |
download | numpy-954e1411c794fa570657f2614912468fe1eabe27.tar.gz |
Add test for numeric type array creation from string values.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index fad5f69a9..ec1bf4369 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -4,6 +4,7 @@ import numpy as np from numpy.testing import * from numpy.core import * + class TestFlags(NumpyTestCase): def setUp(self): self.a = arange(10) @@ -268,6 +269,14 @@ class TestCreation(NumpyTestCase): pass self.failUnlessRaises(ValueError, array, x()) + def check_from_string(self) : + types = np.typecodes['AllInteger'] + np.typecodes['Float'] + nstr = ['123','123'] + result = array([123, 123], dtype=int) + for type in types : + msg = 'String conversion for %s' % type + assert_equal(array(nstr, dtype=type), result, err_msg=msg) + class TestBool(NumpyTestCase): def check_test_interning(self): a0 = bool_(0) |