diff --git a/unittests/test_scanner.py b/unittests/test_scanner.py index 52aa18f4d6e3849bf4de037e1f6069e2965cb91f..6aa7287b2449f49706cb352d24fa8abf66f87115 100644 --- a/unittests/test_scanner.py +++ b/unittests/test_scanner.py @@ -35,15 +35,15 @@ from utils import dircheckstr as dircheck_base UNITTESTDIR = Path(__file__).parent -dircheckstr = partial(dircheck_base, UNITTESTDIR/"test_directories" / "examples_article") +dircheckstr = partial(dircheck_base, UNITTESTDIR / "test_directories" / "examples_article") def test_scan_structure_elements(): tmpfi = NamedTemporaryFile(delete=False) - with open(UNITTESTDIR/"example_datastructure.yml", "r") as f: + with open(UNITTESTDIR / "example_datastructure.yml", "r") as f: data = yaml.load(f, Loader=yaml.SafeLoader) - crawler_definition = load_definition(UNITTESTDIR/"example_cfood.yml") + crawler_definition = load_definition(UNITTESTDIR / "example_cfood.yml") converter_registry = create_converter_registry(crawler_definition) recs = scan_structure_elements(DictElement(name="", value=data), crawler_definition, converter_registry) @@ -54,10 +54,10 @@ def test_provenance_debug_data(): # TODO rewrite the test to use a smaller example setup tmpfi = NamedTemporaryFile(delete=False) debug_tree = DebugTree() - with open(UNITTESTDIR/"example_datastructure.yml", "r") as f: + with open(UNITTESTDIR / "example_datastructure.yml", "r") as f: data = yaml.load(f, Loader=yaml.SafeLoader) - crawler_definition = load_definition(UNITTESTDIR/"example_cfood.yml") + crawler_definition = load_definition(UNITTESTDIR / "example_cfood.yml") converter_registry = create_converter_registry(crawler_definition) stuff = scan_structure_elements(DictElement(name="", value=data), crawler_definition, converter_registry, debug_tree=debug_tree) @@ -83,8 +83,8 @@ def test_record_structure_generation(): # TODO test creation of debug information in a separate test dbt = DebugTree() - scan_directory(UNITTESTDIR/"test_directories" / "examples_article", - UNITTESTDIR/"scifolder_cfood.yml", + scan_directory(UNITTESTDIR / "test_directories" / "examples_article", + UNITTESTDIR / "scifolder_cfood.yml", debug_tree=dbt) subd = dbt.debug_tree[dircheckstr("DataAnalysis")] subc = dbt.debug_metadata["copied"][dircheckstr("DataAnalysis")] @@ -174,13 +174,13 @@ def test_record_generation(): Test the correct list of returned records by the scanner using the scifolder example from the article. """ - - records = scan_directory(UNITTESTDIR/"test_directories" / "examples_article", - UNITTESTDIR/"scifolder_cfood.yml") + + records = scan_directory(UNITTESTDIR / "test_directories" / "examples_article", + UNITTESTDIR / "scifolder_cfood.yml") def parent_filter(parent_name): return [p for p in records if len(p.parents) == 1 and p.parents[0].name == parent_name] - + def check_properties(records, check_props, check_additional=True): records_found = [0 for r in check_props] for rec in records: