diff --git a/unittests/test_identifiable_adapters.py b/unittests/test_identifiable_adapters.py index 5b6b880fc332c8b0b2449058495bf942dce6421f..1c7733acfe952a2f47eff2853c2b90684c098dbf 100644 --- a/unittests/test_identifiable_adapters.py +++ b/unittests/test_identifiable_adapters.py @@ -54,6 +54,8 @@ def mock_retrieve_RecordType(id, name): "Lab": db.RecordType(name="Lab"), "Analysis": db.RecordType(name="Analysis"), "MetaAnalysis": db.RecordType(name="MetaAnalysis").add_parent("Analysis"), + # Test that two parents are possible; only one of them + # (Experiment) has an identifiable. "Measurement": db.RecordType(name="Measurement").add_parent("Experiment").add_parent("A") }[name] @@ -330,16 +332,10 @@ def test_get_registered_identifiable(): with pytest.raises(RuntimeError): registered = ident.get_registered_identifiable(rec) - # Test the case that the record has a parent for which no identifiable is registered - # and there is a registered identifiable for a grand parent - ident = CaosDBIdentifiableAdapter() - ident.load_from_yaml_definition(UNITTESTDIR / "example_identifiables.yml") - rec = db.Record().add_parent(name="Measurement") - registered = ident.get_registered_identifiable(rec) - assert registered is not None - assert registered.parents[0].name == "Experiment" - - # Same again, but with two grand parents + # Test the case that the record has a parent for which no + # identifiable is registered and there is a registered + # identifiable for a grand parent. Note that this also tests the + # case of two grandparents, only one of which has an identifiable. ident = CaosDBIdentifiableAdapter() ident.load_from_yaml_definition(UNITTESTDIR / "example_identifiables.yml") rec = db.Record().add_parent(name="Measurement")