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

TST: added test for creating File entities

parent 0bec5c0c
No related branches found
No related tags found
No related merge requests found
Pipeline #51709 failed
# This is only a scifolder test cfood with a limited functionality.
# The full scifolder cfood will be developed here:
# https://gitlab.indiscale.com/caosdb/src/crawler-cfoods/scifolder-cfood
---
metadata:
crawler-version: 0.3.1
---
Definitions:
type: Definitions
#include "description.yml"
Data: # name of the converter
type: Directory
match: (.*)
subtree:
DataAnalysis: # name of the converter
type: Directory
match: DataAnalysis
subtree: &template
project_dir: # name of the first subtree element which is a converter
type: Directory
match: ((?P<date>[0-9]{4,4})_)?(?P<identifier>.*)
records:
Project: # this is an identifiable in this case
parents:
- Project # not needed as the name is equivalent
date: $date
identifier: ${identifier}
subtree:
measurement: # new name for folders on the 3rd level
type: Directory
match: (?P<date>[0-9]{4,4}-[0-9]{2,2}-[0-9]{2,2})(_(?P<identifier>.*))?
records:
Measurement:
date: $date
identifier: $identifier
project: $Project
subtree:
README:
type: SimpleFile # this is a subclass of converter File
# function signature: GeneralStore, StructureElement
# preprocessors: custom.caosdb.convert_values
match: ^README\.md$
# how to make match case insensitive?
records:
TestFile:
path: $README
file: $README
role: File
...@@ -332,3 +332,12 @@ def test_new_debug_tree(): ...@@ -332,3 +332,12 @@ def test_new_debug_tree():
"unittests/test_directories/examples_article") "unittests/test_directories/examples_article")
assert len(new_debug_tree[0]["matching_converters"]) == 1 # exactly one matches assert len(new_debug_tree[0]["matching_converters"]) == 1 # exactly one matches
assert len(new_debug_tree[0]["matching_converters"][0]["subtree"]) == 4 assert len(new_debug_tree[0]["matching_converters"][0]["subtree"]) == 4
def test_new_debug_tree_files():
new_debug_tree = []
scan_directory(UNITTESTDIR / "test_directories" / "examples_article",
UNITTESTDIR / "cfood_simple_file.yml",
new_debug_tree=new_debug_tree)
assert True # The only purpose of this test is to check whether
# it is possible to create a File entity and set a path.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment