summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-01-21 20:15:14 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-01-21 20:15:14 +0000
commitbeb7e7c80b325df0c16419ce63d87cc2c6ea5ada (patch)
tree81fcce37244d16f6151d65ec8c9b5f8ebe76e9ac
parentf18a0fab69c9da73e3f30231403abede272de1c4 (diff)
downloadnumpy-beb7e7c80b325df0c16419ce63d87cc2c6ea5ada.tar.gz
Added tests for fromstring.
-rw-r--r--numpy/core/tests/test_multiarray.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index f7e2f9b14..bf593c845 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -68,6 +68,16 @@ class test_dtypedescr(ScipyTestCase):
assert_equal(d1, dtype(int32))
d2 = dtype('f8')
assert_equal(d2, dtype(float64))
+
+class test_fromstring(ScipyTestCase):
+ def check_binary(self):
+ a = fromstring('\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@',dtype='<f4')
+ assert_array_equal(a, array([1,2,3,4]))
+
+ def check_ascii(self):
+ a = fromstring('1 , 2 , 3 , 4',sep=',')
+ b = fromstring('1,2,3,4',dtype=float,sep=',')
+ assert_array_equal(a,b)
class test_zero_rank(ScipyTestCase):
def setUp(self):