diff --git a/unittests/test_variable_substitutions.py b/unittests/test_variable_substitutions.py index 203197b7f8af51605a413ac354a0426d61c9c0cb..f6c3b6375a3111faff9d746779805ba16af260b7 100644 --- a/unittests/test_variable_substitutions.py +++ b/unittests/test_variable_substitutions.py @@ -83,3 +83,18 @@ def test_substitutions_parents(crawler_2): assert len(parents) == 2 assert parents[0].name == "Experiment" assert parents[1].name == "Month_05" + + +def test_empty_parents(crawler_2): + # This is a test for: + # https://gitlab.com/caosdb/caosdb-crawler/-/issues/8 + + subd = crawler_2.debug_tree[dircheckstr( + "File", "ExperimentalData", "220512_data.dat")] + + parents = subd[1]["RecordWithoutParents"].get_parents() + assert len(parents) == 0 + + parents = subd[1]["RecordThatGetsParentsLater"].get_parents() + assert len(parents) == 1 + assert parents[0].name == "Month_05"