diff --git a/src/caosdb/apiutils.py b/src/caosdb/apiutils.py index cda2c09b001dc4a236bf0aa1c9dbd57e3b611096..f9c4148f76cc6b3ddcaa75b31c242968bacabf91 100644 --- a/src/caosdb/apiutils.py +++ b/src/caosdb/apiutils.py @@ -686,6 +686,7 @@ def apply_to_ids(entities, func): for entity in entities: _apply_to_ids_of_entity(entity, func) + def _apply_to_ids_of_entity(entity, func): entity.id = func(entity.id) diff --git a/unittests/test_apiutils.py b/unittests/test_apiutils.py index 6705cdeb83cd489dc91eb3d0722993cc722555ba..cdf82ed3a223be878565120159ac800a3b35906c 100644 --- a/unittests/test_apiutils.py +++ b/unittests/test_apiutils.py @@ -48,7 +48,7 @@ def test_pickle_object(): def test_apply_to_ids(): parent = db.RecordType(id=3456) rec = db.Record(id=23) - p = db.Property(id=23345, datatype = db.INTEGER) + p = db.Property(id=23345, datatype=db.INTEGER) rec.add_parent(parent) rec.add_property(p) diff --git a/unittests/test_entity.py b/unittests/test_entity.py index 64f18039f4370c2b0be30b2f2cf309ac858bd1ab..d877e1ab7267977a7e73d65033d6f02c16ea5521 100644 --- a/unittests/test_entity.py +++ b/unittests/test_entity.py @@ -32,14 +32,12 @@ from caosdb.connection.mockup import MockUpServerConnection class TestEntity(unittest.TestCase): - def setUp(self): self.assertIsNotNone(Entity) configure_connection(url="unittests", username="testuser", password="testpassword", timeout=200, implementation=MockUpServerConnection) - def test_instance_variables(self): entity = Entity() self.assertTrue(hasattr(entity, "role")) @@ -49,13 +47,11 @@ class TestEntity(unittest.TestCase): self.assertTrue(hasattr(entity, "parents")) self.assertTrue(hasattr(entity, "properties")) - def test_role(self): entity = Entity(role="TestRole") self.assertEqual(entity.role, "TestRole") entity.role = "TestRole2" self.assertEqual(entity.role, "TestRole2") - def test_instanciation(self): self.assertRaises(Exception, Entity())