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

TST: a second test for variable deletion behavior

parent 0c6b2cf6
No related branches found
No related tags found
2 merge requests!160STY: styling,!125F delete variables correctly
...@@ -355,9 +355,17 @@ def scan_directory(dirname: str, crawler_definition_path: str, ...@@ -355,9 +355,17 @@ def scan_directory(dirname: str, crawler_definition_path: str,
Convenience function that starts the crawler (calls start_crawling) Convenience function that starts the crawler (calls start_crawling)
with a single directory as the StructureElement. with a single directory as the StructureElement.
Parameters
----------
restricted_path: optional, list of strings restricted_path: optional, list of strings
Traverse the data tree only along the given path. When the end of the given path Traverse the data tree only along the given path. When the end of the given path
is reached, traverse the full tree as normal. is reached, traverse the full tree as normal.
Returns
-------
crawled_data : list
the final list with the target state of Records.
""" """
crawler_definition = load_definition(crawler_definition_path) crawler_definition = load_definition(crawler_definition_path)
......
...@@ -248,10 +248,8 @@ def test_record_generation(): ...@@ -248,10 +248,8 @@ def test_record_generation():
def test_variable_deletion_problems(): def test_variable_deletion_problems():
debug_tree = DebugTree()
records = scan_directory(UNITTESTDIR / "test_directories" / "example_variable_deletion", records = scan_directory(UNITTESTDIR / "test_directories" / "example_variable_deletion",
UNITTESTDIR / "cfood_variable_deletion.yml", UNITTESTDIR / "cfood_variable_deletion.yml")
debug_tree=debug_tree)
for record in records: for record in records:
if record.name == "Record from Data_1": if record.name == "Record from Data_1":
...@@ -262,3 +260,16 @@ def test_variable_deletion_problems(): ...@@ -262,3 +260,16 @@ def test_variable_deletion_problems():
assert record.get_property("var2").value == "test" assert record.get_property("var2").value == "test"
else: else:
raise RuntimeError("Wrong name") raise RuntimeError("Wrong name")
records = scan_directory(UNITTESTDIR / "test_directories" / "example_variable_deletion",
UNITTESTDIR / "cfood_variable_deletion2.yml")
for record in records:
if record.name == "Record from Data_1":
assert record.get_property("var1").value == "bla"
assert record.get_property("var2").value == "$test_2"
elif record.name == "Record from Data_2":
assert record.get_property("var1").value == "example_variable_deletion"
assert record.get_property("var2").value == "test"
else:
raise RuntimeError("Wrong name")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment