[h5py] 370/455: Link 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 d8021fe1dd4b00899dd19d3f715da4b86a09fa01
Author: andrewcollette <andrew.collette at gmail.com>
Date: Wed Jan 20 06:59:35 2010 +0000
Link tests
---
h5py/tests/high/test_links.py | 60 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/h5py/tests/high/test_links.py b/h5py/tests/high/test_links.py
new file mode 100644
index 0000000..76aba76
--- /dev/null
+++ b/h5py/tests/high/test_links.py
@@ -0,0 +1,60 @@
+
+
+from h5py import tests
+import h5py
+
+class TestClass(tests.HTest):
+
+ def test_spath(self):
+ """ (Links) Soft link path attribute """
+ sl = h5py.SoftLink('/foo')
+ self.assertEqual(sl.path, '/foo')
+
+ def test_srepr(self):
+ """ (Links) Soft link repr """
+ sl = h5py.SoftLink('/foo')
+ self.assertIsInstance(repr(sl), basestring)
+
+ @tests.require(api=18)
+ def test_epath(self):
+ """ (Links) External path/file attributes """
+ el = h5py.ExternalLink('foo.hdf5', '/foo')
+ self.assertEqual(el.filename, 'foo.hdf5')
+ self.assertEqual(el.path, '/foo')
+
+ @tests.require(api=18)
+ def test_erepr(self):
+ """ (Links) External link repr() """
+ el = h5py.ExternalLink('foo.hdf5','/foo')
+ self.assertIsInstance(repr(el), basestring)
+
+class Base(tests.HTest):
+
+ def setUp(self):
+ import tempfile
+ self.name = tempfile.mktemp()
+ self.f = h5py.File(self.name, 'w')
+
+ def tearDown(self):
+ self.f.close()
+ import os
+ os.unlink(self.name)
+
+class TestSoft(Base):
+
+ def test_create(self):
+ """ (Links) Soft links creation """
+ g = self.f.create_group('new')
+ sl = h5py.SoftLink('/new')
+ self.f['alias'] = sl
+ g2 = self.f['alias']
+ self.assertEqual(g, g2)
+ self.assertEqual(self.f.get('alias', getclass=True, getlink=True), h5py.SoftLink)
+
+ def test_exc(self):
+ """ (Links) Dangling soft links raise KeyError """
+ self.f['alias'] = h5py.SoftLink('new')
+ self.assertRaises(KeyError, self.f.__getitem__, 'alias')
+
+
+
--
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