[h5py] 394/455: Clarify comparison rules

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:54 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 3072bb6b7408a5b270f908aa453d5fbbc10d5284
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Mon Feb 8 02:55:16 2010 +0000

    Clarify comparison rules
---
 h5py/highlevel.py                | 4 +++-
 h5py/tests/high/test_hlobject.py | 7 +++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/h5py/highlevel.py b/h5py/highlevel.py
index 3a85f6a..d0df762 100644
--- a/h5py/highlevel.py
+++ b/h5py/highlevel.py
@@ -821,10 +821,12 @@ class File(Group):
             (os.path.basename(self.filename), self.mode,
              _extras.sizestring(self.fid.get_filesize()))
 
-    # Fix up identity to use the file identifier, not the root group.
+
     def __hash__(self):
         return hash(self.fid)
     def __eq__(self, other):
+        # Python requires that objects which compare equal hash the same.
+        # Therefore comparison to generic Group objects is impossible
         if hasattr(other, 'fid'):
             return self.fid == other.fid
         return False
diff --git a/h5py/tests/high/test_hlobject.py b/h5py/tests/high/test_hlobject.py
index 9133600..94b4c61 100644
--- a/h5py/tests/high/test_hlobject.py
+++ b/h5py/tests/high/test_hlobject.py
@@ -44,14 +44,13 @@ class TestProps(Base):
 
 class TestParent(Base):
 
-    @tests.fixme("File object does not compare equal to Group '/'")
     def test_parent(self):
         """ (HLObject) .parent """
-        self.assertEqual(self.f.parent, self.f)
+        self.assertEqual(self.f.parent, self.f['/'])
         g = self.f.create_group('a')
-        g2 = self.f.create_group('b')
+        g2 = self.f.create_group('a/b')
         self.assertEqual(g2.parent, g)
-        self.assertEqual(g.parent, self.f)
+        self.assertEqual(g.parent, self.f['/'])
 
 
 

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