diff --git a/unittests/test_h5.py b/unittests/test_h5.py index 360d4b28938492d0f2af6d696e39dffb1cc3fead..caf1eab4827e8e9b4666f6c80f01bd7818cc76f2 100644 --- a/unittests/test_h5.py +++ b/unittests/test_h5.py @@ -1,8 +1,8 @@ import unittest from tempfile import NamedTemporaryFile -import caosdb as db -import caosdb.apiutils +import linkahead as db +import linkahead.apiutils import h5py import numpy as np from caosadvancedtools.cfoods import h5 @@ -77,8 +77,8 @@ class H5CFoodTest(unittest.TestCase): # TODO this does probably break the code: The function will not be # restored correctly. # Change it to use the BaseMockUpTest - real_retrieve = caosdb.apiutils.retrieve_entity_with_id - caosdb.apiutils.retrieve_entity_with_id = dummy_get + real_retrieve = linkahead.apiutils.retrieve_entity_with_id + linkahead.apiutils.retrieve_entity_with_id = dummy_get # should run without problem h5.collect_existing_structure(db.Record(), db.Record(id=234), h5.EntityMapping()) @@ -92,6 +92,8 @@ class H5CFoodTest(unittest.TestCase): r_target.add_property("test", value=r_child, datatype=db.REFERENCE) em = h5.EntityMapping() h5.collect_existing_structure(r_target, r_exist, em) + print(em.to_existing[r_child._cuid]) + print(ENTS[101]) self.assertTrue(em.to_existing[r_child._cuid] is ENTS[101]) self.assertTrue(em.to_target[101] is r_child) @@ -151,7 +153,7 @@ class H5CFoodTest(unittest.TestCase): self.assertEqual(em.to_existing[r_child2._cuid], ENTS[101]) self.assertEqual(em.to_target[101], r_child2) - caosdb.apiutils.retrieve_entity_with_id = real_retrieve + linkahead.apiutils.retrieve_entity_with_id = real_retrieve def test_h5_attr_to_property(self): @@ -160,7 +162,8 @@ class H5CFoodTest(unittest.TestCase): test_float = np.float_(1.0) test_str = "Test" test_complex: complex = 2+3j - self.assertRaises(NotImplementedError, h5_attr_to_property, test_int) # only numpy-integers processed? + self.assertRaises(NotImplementedError, h5_attr_to_property, + test_int) # only numpy-integers processed? self.assertTupleEqual((1, db.INTEGER), h5_attr_to_property(test_integer)) self.assertTupleEqual((1.0, db.DOUBLE), h5_attr_to_property(test_float)) self.assertTupleEqual(("Test", db.TEXT), h5_attr_to_property(test_str)) @@ -187,4 +190,5 @@ class H5CFoodTest(unittest.TestCase): # Test scalar values given as np.array self.assertTupleEqual((1, db.INTEGER), h5_attr_to_property(np.array(1))) self.assertTupleEqual((1.123, db.DOUBLE), h5_attr_to_property(np.array(1.123))) - self.assertTupleEqual(('Hello World', db.TEXT), h5_attr_to_property(np.array("Hello World"))) + self.assertTupleEqual(('Hello World', db.TEXT), + h5_attr_to_property(np.array("Hello World")))