summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorChristoph Gohlke <cgohlke@uci.edu>2011-04-02 12:39:29 -0600
committerCharles Harris <charlesr.harris@gmail.com>2011-04-02 13:10:37 -0600
commit5d5266cbf90c352251ccf5d72a2a2eba7fe235b5 (patch)
treee96ee312774e57dcb3ba18d26a557a14348582cf /numpy/lib/tests
parente05da9e451c0dcbc892423601edd7c354117456e (diff)
downloadnumpy-5d5266cbf90c352251ccf5d72a2a2eba7fe235b5.tar.gz
BUG: ticket #1565, fix conversion of int64 and uint64 types by loadtxt.
Add some tests for these types.
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_io.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 96e92c776..6458d8916 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -425,6 +425,22 @@ class TestLoadTxt(TestCase):
dtype=ndtype)
assert_equal(test, control)
+ def test_uint64_type(self):
+ tgt = (9223372043271415339, 9223372043271415853)
+ c = StringIO()
+ c.write(asbytes("%s %s" % tgt))
+ c.seek(0)
+ res = np.loadtxt(c, dtype=np.uint64)
+ assert_equal(res, tgt)
+
+ def test_int64_type(self):
+ tgt = (-9223372036854775807, 9223372036854775807)
+ c = StringIO()
+ c.write(asbytes("%s %s" % tgt))
+ c.seek(0)
+ res = np.loadtxt(c, dtype=np.int64)
+ assert_equal(res, tgt)
+
def test_universal_newline(self):
f, name = mkstemp()
os.write(f, asbytes('1 21\r3 42\r'))