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

TST: added failing test for issue 35

parent 3412582e
No related branches found
No related tags found
2 merge requests!53Release 0.1,!37F fix parent subst
Pipeline #28682 failed
ExperimentalData: # name of the converter
type: Directory
match: ExperimentalData
records:
Project:
name: project
subtree:
File: # name of the converter
type: SimpleFile
match: (?P<year>[0-9]{2,2})(?P<month>[0-9]{2,2})(?P<day>[0-9]{2,2})_data.dat
records:
Experiment:
parents:
- Experiment
- Month_$month # This adds a special parent as record type
date: 20$year-$month-$day
ExperimentSeries:
Experiment: $Experiment
Project:
Experiments: +$Experiment
dates: +20$year-$month-$day
...@@ -39,6 +39,14 @@ def crawler(): ...@@ -39,6 +39,14 @@ def crawler():
rfp("test_directories", "example_substitutions", "substitutions.yml")) rfp("test_directories", "example_substitutions", "substitutions.yml"))
return crawler return crawler
@pytest.fixture
def crawler_2():
crawler = Crawler(debug=True)
crawler.crawl_directory(rfp("test_directories", "example_substitutions", "ExperimentalData"),
rfp("test_directories", "example_substitutions",
"substitutions_parents.yml"))
return crawler
def test_substitutions(crawler): def test_substitutions(crawler):
# @review Florian Spreckelsen 2022-05-13 # @review Florian Spreckelsen 2022-05-13
...@@ -59,3 +67,8 @@ def test_substitutions(crawler): ...@@ -59,3 +67,8 @@ def test_substitutions(crawler):
assert isinstance(subd[i]["Project"].get_property("dates").value, list) assert isinstance(subd[i]["Project"].get_property("dates").value, list)
assert subd[i]["Project"].get_property( assert subd[i]["Project"].get_property(
"dates").value[0] == "2022-05-12" "dates").value[0] == "2022-05-12"
def test_substitutions_parents(crawler_2):
# This is a test for:
# https://gitlab.indiscale.com/caosdb/src/caosdb-crawler/-/issues/35
# ... testing whether variable substitutions can be used in parent declarations.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment