diff options
| author | Jay Bourque <jay.bourque@continuum.io> | 2013-04-25 17:00:06 -0500 |
|---|---|---|
| committer | Jay Bourque <jay.bourque@continuum.io> | 2013-04-25 17:00:06 -0500 |
| commit | 496f68336f8a434062f61725ca22025895185cd4 (patch) | |
| tree | 0d56addf62bcde35fa2ee1f1613a65782c6c94dc /numpy | |
| parent | c6df6b1071fb1077dc0e116cdcd20a604221a9c6 (diff) | |
| download | numpy-496f68336f8a434062f61725ca22025895185cd4.tar.gz | |
Add tests for strings shorter than 64 characters
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/core/src/multiarray/convert_datatype.c | 2 | ||||
| -rw-r--r-- | numpy/core/tests/test_api.py | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/convert_datatype.c b/numpy/core/src/multiarray/convert_datatype.c index cb1caec08..957a74fde 100644 --- a/numpy/core/src/multiarray/convert_datatype.c +++ b/numpy/core/src/multiarray/convert_datatype.c @@ -236,7 +236,7 @@ PyArray_AdaptFlexibleDType(PyObject *data_obj, PyArray_Descr *data_dtype, data_obj != NULL) { /* * Convert data array to list of objects since - * GetArrayParamsFromObject won't iterator through + * GetArrayParamsFromObject won't iterate through * items in an array. */ list = PyArray_ToList(data_obj); diff --git a/numpy/core/tests/test_api.py b/numpy/core/tests/test_api.py index ce4658fd4..8ab48f2d1 100644 --- a/numpy/core/tests/test_api.py +++ b/numpy/core/tests/test_api.py @@ -101,6 +101,16 @@ def test_array_astype(): assert_equal(a, b) assert_equal(b.dtype, np.dtype('U100')) + # Same test as above but for strings shorter than 64 characters + a = np.array([b'a'*10], dtype='O') + b = a.astype('S') + assert_equal(a, b) + assert_equal(b.dtype, np.dtype('S10')) + a = np.array([sixu('a')*10], dtype='O') + b = a.astype('U') + assert_equal(a, b) + assert_equal(b.dtype, np.dtype('U10')) + def test_copyto_fromscalar(): a = np.arange(6, dtype='f4').reshape(2,3) |
