Ejemplo n.º 1
0
def test_parse_valid_entries(valid_catalog_names, valid_extensions,
                             valid_wings_datasets):
    for valid_catalog_name, valid_wings_dataset in zip(valid_catalog_names,
                                                       valid_wings_datasets):
        parsed_wings_dataset = parse_wing_info(valid_catalog_name,
                                               valid_extensions)
        assert parsed_wings_dataset == valid_wings_dataset
Ejemplo n.º 2
0
def test_prioritize_multiple_extensions():
    extensions = {".html", ".profile.html", ".csv", ".true.csv"}
    valid_catalog_names = [
        "01_raw/test.html",
        "01_raw/test.profile.html",
        "01_raw/test.true.csv",
    ]
    for valid_catalog_name in valid_catalog_names:
        parsed_wing = parse_wing_info(valid_catalog_name, extensions)
        assert (os.path.join(parsed_wing.directory,
                             parsed_wing.basename) == valid_catalog_name)
Ejemplo n.º 3
0
def test_managing_namespaces():
    extensions = {".html", ".parquet", ".profile.parquet"}
    valid_catalog_names = [
        "01_raw/test.html",
        "example1.01_raw/test.html",
        "example2.01_raw/test.html",
    ]

    namespaces = [
        "example1",
        "example2",
    ]

    for valid_catalog_name in valid_catalog_names:
        parsed_wing = parse_wing_info(valid_catalog_name, extensions,
                                      namespaces)
        if parsed_wing.namespace:
            assert (
                f"{parsed_wing.namespace}.{parsed_wing.directory}/{parsed_wing.name}{parsed_wing.extension}"
                == valid_catalog_name)
        else:
            assert (
                f"{parsed_wing.directory}/{parsed_wing.name}{parsed_wing.extension}"
                == valid_catalog_name)
Ejemplo n.º 4
0
def test_parse_invalid_entries(valid_catalog_names):
    for valid_catalog_name in valid_catalog_names:
        assert WingInfo() == parse_wing_info(valid_catalog_name, set())