Skip to content
Snippets Groups Projects
Commit ccabcbbb authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

TST: adapted tests for eln files

parent afefa748
Branches
Tags
2 merge requests!217TST: Make NamedTemporaryFiles Windows-compatible,!215Fix issues in rocrate support
Pipeline #60020 failed
File deleted
No preview for this file type
...@@ -76,6 +76,12 @@ def eln_entities(basic_eln_converter): ...@@ -76,6 +76,12 @@ def eln_entities(basic_eln_converter):
return entities return entities
@pytest.mark.xfail(
reason="The example files for PASTA have not yet been updated in:"
"https://github.com/TheELNConsortium/TheELNFileFormat/tree/master/examples/PASTA"
"However, there was the announcement that these files are going to follow the"
"flattened structure soon: https://github.com/TheELNConsortium/TheELNFileFormat/issues/98"
)
def test_load_pasta(basic_eln_converter): def test_load_pasta(basic_eln_converter):
""" """
Test for loading the .eln example export from PASTA. Test for loading the .eln example export from PASTA.
...@@ -99,7 +105,7 @@ def test_load_kadi4mat(basic_eln_converter): ...@@ -99,7 +105,7 @@ def test_load_kadi4mat(basic_eln_converter):
match = basic_eln_converter.match(f_k4mat) match = basic_eln_converter.match(f_k4mat)
assert match is not None assert match is not None
entities = basic_eln_converter.create_children(GeneralStore(), f_k4mat) entities = basic_eln_converter.create_children(GeneralStore(), f_k4mat)
assert len(entities) == 10 assert len(entities) == 17
assert isinstance(entities[0], ROCrateEntity) assert isinstance(entities[0], ROCrateEntity)
assert isinstance(entities[0].folder, str) assert isinstance(entities[0].folder, str)
assert isinstance(entities[0].entity, Entity) assert isinstance(entities[0].entity, Entity)
...@@ -131,7 +137,7 @@ match_properties: ...@@ -131,7 +137,7 @@ match_properties:
match = ds2.match(eln_entities[1]) match = ds2.match(eln_entities[1])
assert match is not None assert match is not None
assert match["dateCreated"] == "2024-08-21T12:07:45.115990+00:00" assert match["dateCreated"] == "2024-11-19T13:44:35.476888+00:00"
children = ds2.create_children(GeneralStore(), eln_entities[1]) children = ds2.create_children(GeneralStore(), eln_entities[1])
assert len(children) == 8 assert len(children) == 8
...@@ -193,7 +199,20 @@ def test_scanner(): ...@@ -193,7 +199,20 @@ def test_scanner():
assert len(rlist) == 1 assert len(rlist) == 1
assert isinstance(rlist[0], db.Record) assert isinstance(rlist[0], db.Record)
assert rlist[0].name == "records-example" assert rlist[0].name == "records-example"
assert rlist[0].description == "This is a sample record." # This assertion was moved to a different test, see below:
# assert rlist[0].description == "This is a sample record."
assert rlist[0].parents[0].name == "Dataset" assert rlist[0].parents[0].name == "Dataset"
assert rlist[0].get_property("keywords").value == "sample" assert rlist[0].get_property("keywords").value == "sample"
assert rlist[0].get_property("dateModified").value == "2024-08-21T11:43:17.626965+00:00" assert rlist[0].get_property("dateModified").value == "2024-08-21T11:43:17.626965+00:00"
@pytest.mark.xfail(
reason="The description is no longer a simple string, but a reference to another record."
"The rocrate converter will be able to dereference this as soon as this feature is implemented:"
"https://gitlab.indiscale.com/caosdb/src/caosdb-crawler/-/issues/191"
"This test might need changes in the yaml definition."
)
def test_description_reference():
rlist = scanner.scan_directory(os.path.join(UNITTESTDIR, "eln_files/"),
os.path.join(UNITTESTDIR, "eln_cfood.yaml"))
assert rlist[0].description == "This is a sample record."
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment