[h5py] 368/455: Port H5T tests

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.

commit 4bbb7fef195171ddaf973d3c545b48850c1d2526
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Wed Jan 20 01:18:44 2010 +0000

    Port H5T tests
---
 h5py/tests/low/test_h5t.py | 91 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/h5py/tests/low/test_h5t.py b/h5py/tests/low/test_h5t.py
new file mode 100644
index 0000000..52c84d8
--- /dev/null
+++ b/h5py/tests/low/test_h5t.py
@@ -0,0 +1,91 @@
+
+"""
+    H5T tests.  This handles the general API behavior and exceptions; full
+    type-specific tests (including conversion) are tested elsewhere.
+"""
+
+from h5py import tests
+from h5py import *
+
+class Base(tests.HTest):
+    pass
+
+class TestCreate(Base):
+
+    def test_create(self):
+        """ (H5T) create() """
+        tid = h5t.create(h5t.OPAQUE, 72)
+        self.assertIsInstance(tid, h5t.TypeOpaqueID)
+
+    def test_exc(self):
+        """ (H5T) ValueError for non-opaque, non-compound class """
+        self.assertRaises(ValueError, h5t.create, h5t.INTEGER, 4)
+
+class TestCommit(Base):
+
+    def setUp(self):
+        self.fid, self.name = tests.gettemp()
+
+    def tearDown(self):
+        import os
+        self.fid.close()
+        os.unlink(self.name)
+
+    def test_commit_committed(self):
+        """ (H5T) Commit type changes committed() """
+        tid = h5t.STD_I32LE.copy()
+        self.assert_(not tid.committed())
+        tid.commit(self.fid, 'name')
+        self.assert_(tid.committed())
+
+    @tests.require(api=18)
+    def test_commit_pl(self):
+        """ (H5T) Commit type with non-default LCPL """
+        tid = h5t.STD_I32LE.copy()
+        tid.commit(self.fid, 'name', lcpl=h5p.create(h5p.LINK_CREATE))
+        self.assert_(tid.committed())
+
+    def test_open(self):
+        """ (H5T) Open committed type """
+        tid = h5t.STD_I32LE.copy()
+        tid.commit(self.fid, 'name')
+        tid2 = h5t.open(self.fid, 'name')
+        self.assertEqual(tid, tid2)
+
+    def test_open_exc(self):
+        """ (H5T) Open missing type raises KeyError """
+        self.assertRaises(KeyError, h5t.open, self.fid, 'missing')
+
+class TestTypeID(Base):
+
+    """ Common simple TypeID operations """
+
+    def test_copy(self):
+        """ (H5T) copy() """
+        tid = h5t.create(h5t.OPAQUE, 72)
+        tid2 = tid.copy()
+        self.assertEqual(tid, tid2)
+        self.assert_(tid is not tid2)
+     
+    def test_lock(self):
+        """ (H5T) Modification of locked type raises TypeError """
+        htype = h5t.STD_I8LE.copy()
+        htype.set_sign(h5t.SGN_NONE)
+        htype.lock()
+        self.assertRaises(TypeError, htype.set_sign, h5t.SGN_2)
+
+    def test_equal(self):
+        """ (H5T) equal() """
+        tid = h5t.STD_I32LE.copy()
+        self.assert_(tid.equal(h5t.STD_I32LE))
+        self.assert_(h5t.STD_I32LE.equal(tid))
+        self.assert_(not tid.equal(h5t.STD_I32BE))
+
+    def test_get_class(self):
+        """ (H5T) get_class() """
+        self.assertEqual(h5t.STD_I32LE.get_class(), h5t.INTEGER)
+
+
+    
+
+    

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git



More information about the debian-science-commits mailing list