Skip to content
Snippets Groups Projects
Verified Commit 68afeba7 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

MAINT: Moved test function to more appropriate file.

parent 1d20070b
No related branches found
No related tags found
1 merge request!54Get parents recursively
Pipeline #33722 canceled
......@@ -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]
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment