[h5py] 366/455: H5S 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 937085454f309f4c11a5121b8e14ed6cb970308f
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Mon Jan 18 00:17:14 2010 +0000

    H5S tests
---
 h5py/tests/low/test_h5s.py | 29 ++++++++++++++++++++---------
 h5py/tests/test_h5s.py     |  5 -----
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/h5py/tests/low/test_h5s.py b/h5py/tests/low/test_h5s.py
index ade782d..9b3e5d8 100644
--- a/h5py/tests/low/test_h5s.py
+++ b/h5py/tests/low/test_h5s.py
@@ -2,7 +2,15 @@
 from h5py import tests
 from h5py import *
 
-class TestCreate(tests.HTest):
+class Base(tests.HTest):
+
+    def assertEqualSpaces(self, sid1, sid2):
+        self.assertIsInstance(sid1, h5s.SpaceID)
+        self.assertIsInstance(sid2, h5s.SpaceID)
+        self.assertEqual(sid1.shape, sid2.shape)
+        self.assertEqual(sid1.get_select_bounds(), sid2.get_select_bounds())
+
+class TestCreate(Base):
 
     def test_scalar(self):
         """ (H5S) Create scalar dataspace """
@@ -45,7 +53,7 @@ class TestCreate(tests.HTest):
         """ (H5S) Extent/limit rank mismatch raises ValueError """
         self.assertRaises(ValueError, h5s.create_simple, (10,10), (20,))
 
-class TestEncodeDecode(tests.HTest):
+class TestEncodeDecode(Base):
 
     def setUp(self):
         self.sid = h5s.create_simple((10,10))
@@ -54,12 +62,6 @@ class TestEncodeDecode(tests.HTest):
     def tearDown(self):
         del self.sid
 
-    def assertEqualSpaces(self, sid1, sid2):
-        self.assertIsInstance(sid1, h5s.SpaceID)
-        self.assertIsInstance(sid2, h5s.SpaceID)
-        self.assertEqual(sid1.shape, sid2.shape)
-        self.assertEqual(sid1.get_select_bounds(), sid2.get_select_bounds())
-
     @tests.require(api=18)
     def test_ed(self):
         """ (H5S) Encode/decode round trip """
@@ -76,7 +78,16 @@ class TestEncodeDecode(tests.HTest):
         dec = pickle.loads(pkl)
         self.assertEqualSpaces(self.sid, dec)
 
-     
+class TestCopy(Base):
+
+    def test_copy(self):
+        """ (H5S) Copy """
+        sid = h5s.create_simple((10,10))
+        sid.select_hyperslab((2,2), (5,5))
+        sid2 = sid.copy()
+        self.assertEqualSpaces(sid, sid2)
+        self.assert_(sid is not sid2)
+
 
 
 
diff --git a/h5py/tests/test_h5s.py b/h5py/tests/test_h5s.py
index 84f56dd..6b2bd95 100644
--- a/h5py/tests/test_h5s.py
+++ b/h5py/tests/test_h5s.py
@@ -26,11 +26,6 @@ class TestH5S(unittest.TestCase):
         sid._close()
         self.assertEqual(h5i.get_type(sid), h5i.BADID)
 
-    def test_copy(self):
-        sid = h5s.create(h5s.SCALAR)
-        sid2 = sid.copy()
-        self.assertEqual(h5i.get_type(sid2), h5i.DATASPACE)
-
     def test_offset_simple(self):
         
         sid = h5s.create_simple((100,100))

-- 
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