Ejemplo n.º 1
0
def test__normalize_absolute_or_relative_path(tmp_path_factory, basic_data_context_config):
    config_path = str(tmp_path_factory.mktemp('test__normalize_absolute_or_relative_path__dir'))
    context = BaseDataContext(
        basic_data_context_config,
        config_path,
    )

    assert str(os.path.join("test__normalize_absolute_or_relative_path__dir0", "yikes")) in context._normalize_absolute_or_relative_path("yikes")

    assert "test__normalize_absolute_or_relative_path__dir" not in context._normalize_absolute_or_relative_path("/yikes")
    assert "/yikes" == context._normalize_absolute_or_relative_path("/yikes")
def test__normalize_absolute_or_relative_path(tmp_path_factory,
                                              basic_data_context_v013_config):
    config_path = str(
        tmp_path_factory.mktemp(
            "test__normalize_absolute_or_relative_path__dir"))
    context = BaseDataContext(
        basic_data_context_v013_config,
        config_path,
    )

    pattern_string = os.path.join(
        "^.*test__normalize_absolute_or_relative_path__dir\\d*", "yikes$")
    pattern = re.compile(pattern_string)
    assert (pattern.match(
        context._normalize_absolute_or_relative_path("yikes")) is not None)

    assert ("test__normalize_absolute_or_relative_path__dir"
            not in context._normalize_absolute_or_relative_path("/yikes"))
    assert "/yikes" == context._normalize_absolute_or_relative_path("/yikes")