diff --git a/tests/test_parents.py b/tests/test_parents.py index abae9001dbde21cfd2f22b34a576cb8460399729..d038350a27cb0a9bb2db79020957dc401e1b1e10 100644 --- a/tests/test_parents.py +++ b/tests/test_parents.py @@ -41,23 +41,3 @@ def test_parent_name_id_mismatch(): with raises(db.TransactionError): rt2.insert() print(rt2) - - -def test_get_parents_recursively(): - """Test for https://gitlab.com/caosdb/caosdb-pylib/-/issues/90 - -> Entity.get_parents_recursively() does not work unless the full ancestry has been retrieved from -> the server. -""" - # Setup - rt_A = db.RecordType(name="TestA") - rt_B = db.RecordType(name="TestB").add_parent(rt_A) - rt_C = db.RecordType(name="TestC").add_parent(rt_B) - db.Container().extend([rt_A, rt_B, rt_C]).insert() - - # Retrieve only C - retrieved_C = db.RecordType(name="TestC").retrieve() - parents = retrieved_C.get_parents_recursively(retrieve=True) - assert len(parents) == 2 - assert "TestB" in [p.name for p in parents] - assert "TestA" in [p.name for p in parents] diff --git a/tests/test_recursive_parents.py b/tests/test_recursive_parents.py index fff5f64361fa37e99c8251891d2cc45c92d8ba97..c262e7ceef1e777e91dc6c88601b74f06590a999 100644 --- a/tests/test_recursive_parents.py +++ b/tests/test_recursive_parents.py @@ -48,7 +48,26 @@ def teardown_function(function): setup_module() -# @pytest.mark.xfail(reason="To be fixed in server and/or pylib") +def test_get_parents_recursively(): + """Test for https://gitlab.com/caosdb/caosdb-pylib/-/issues/90 + +> Entity.get_parents_recursively() does not work unless the full ancestry has been retrieved from +> the server. +""" + # Setup + rt_A = db.RecordType(name="TestA") + rt_B = db.RecordType(name="TestB").add_parent(rt_A) + rt_C = db.RecordType(name="TestC").add_parent(rt_B) + db.Container().extend([rt_A, rt_B, rt_C]).insert() + + # Retrieve only C + retrieved_C = db.RecordType(name="TestC").retrieve() + parents = retrieved_C.get_parents_recursively(retrieve=True) + assert len(parents) == 2 + assert "TestB" in [p.name for p in parents] + assert "TestA" in [p.name for p in parents] + + def test_recursive_parents(): # inheritance structure: # A @@ -91,7 +110,6 @@ def test_recursive_parents(): assert (C.id, C.name) in parent_identifiers -# @pytest.mark.xfail(reason="To be fixed in server and/or pylib") def test_entity_has_parent(): # inheritance structure: # A