[python-hdf5storage] 47/84: Added tests for write-readback of longs and an error being raised when trying to write an int or long too big for a numpy.int64.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:25:02 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 0.1.10
in repository python-hdf5storage.
commit 9e811a7a38de060a96d3b9d6f433ff09cb053004
Author: Freja Nordsiek <fnordsie at gmail.com>
Date: Sun Apr 26 04:10:03 2015 -0400
Added tests for write-readback of longs and an error being raised when trying to write an int or long too big for a numpy.int64.
---
tests/test_write_readback.py | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tests/test_write_readback.py b/tests/test_write_readback.py
index c0f863b..c98cab1 100644
--- a/tests/test_write_readback.py
+++ b/tests/test_write_readback.py
@@ -40,6 +40,8 @@ import numpy.random
import hdf5storage
+from nose.tools import raises
+
from asserts import *
@@ -370,6 +372,24 @@ class TestPythonMatlabFormat(object):
self.options)
self.assert_equal(out, data)
+ # Only relevant in Python 2.x.
+ def test_long(self):
+ if sys.hexversion < 0x03000000:
+ data = long(self.random_int())
+ out = self.write_readback(data, self.random_name(),
+ self.options)
+ self.assert_equal(out, data)
+
+ @raises(NotImplementedError)
+ def test_int_or_long_too_big(self):
+ if sys.hexversion >= 0x03000000:
+ data = 2**64 * self.random_int()
+ else:
+ data = long(2)**64 * long(self.random_int())
+ out = self.write_readback(data, self.random_name(),
+ self.options)
+ self.assert_equal(out, data)
+
def test_float(self):
data = self.random_float()
out = self.write_readback(data, self.random_name(),
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-hdf5storage.git
More information about the debian-science-commits
mailing list