summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2011-03-05 15:21:12 -0700
committerCharles Harris <charlesr.harris@gmail.com>2011-03-05 15:21:12 -0700
commit3f0f12ffeb202a414d81e45254a135c8e4c74690 (patch)
tree46f43c9f49beab1ce2d6f09902f20080ddfe86fd
parent9eee670c62d539b0f9027d2c989073e2ee81103b (diff)
downloadnumpy-3f0f12ffeb202a414d81e45254a135c8e4c74690.tar.gz
ENH: Add test for ticket #1756.
-rw-r--r--numpy/core/tests/test_regression.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index 48a745bfe..4d7ab05fd 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -1545,5 +1545,14 @@ class TestRegression(TestCase):
b = a.astype('str')
assert_equal(b.dtype, np.dtype('S5'))
+ def test_string_astype(self):
+ """Ticket #1756 """
+ s = '12345'
+ a = np.array([s]*5)
+ for i in range(1,6):
+ a1 = np.array(a, "|S%d"%i)
+ a2 = np.array([s[:i]]*5)
+ assert_equal(a1, a2)
+
if __name__ == "__main__":
run_module_suite()