Example #1
0
def test_parse_period_in_name_double_no_extension():
    filepath = 'test.1.pkl.gz'
    extension = filepath[-7:]
    parsed_extension = _parse_and_validate_extension(Path(filepath), extension,
                                                     {'.pkl.gz': None})
    assert parsed_extension == extension
Example #2
0
def test_parse_double_extension_given_extension():
    filepath = 'test.pkl.gz'
    extension = filepath[-7:]
    parsed_extension = _parse_and_validate_extension(Path(filepath), extension,
                                                     {'.pkl.gz': None})
    assert parsed_extension == extension
Example #3
0
def test_parse_period_in_name_no_extension():
    filepath = 'test.1.jpg'
    extension = filepath[-4:]
    parsed_extension = _parse_and_validate_extension(Path(filepath), None,
                                                     {'.jpg': None})
    assert parsed_extension == extension
Example #4
0
def test_parse_mot_matching_extension_raises_ValueError():
    filepath = 'test.jpg2'
    with raises(ValueError):
        _parse_and_validate_extension(Path(filepath), '.jpg', {'.jpg': None})
Example #5
0
def test_parse_extension_no_given_extension():
    filepath = 'test.jpg'
    extension = filepath[-4:]
    parsed_extension = _parse_and_validate_extension(Path(filepath), None,
                                                     {'.jpg': None})
    assert parsed_extension == extension
Example #6
0
def test_parse_period_in_name_double_given_extension():
    filepath = "test.1.pkl.gz"
    extension = filepath[-7:]
    parsed_extension = _parse_and_validate_extension(Path(filepath), extension,
                                                     {".pkl.gz": None})
    assert parsed_extension == extension
Example #7
0
def test_parse_unknown_extension_raises_ValueError():
    filepath = 'test.1.fake'
    with raises(ValueError):
        _parse_and_validate_extension(Path(filepath), None, {'.jpg': None})
Example #8
0
def test_parse_double_extension_no_extension():
    filepath = "test.pkl.gz"
    extension = filepath[-7:]
    parsed_extension = _parse_and_validate_extension(Path(filepath), None,
                                                     {".pkl.gz": None})
    assert parsed_extension == extension
Example #9
0
def test_parse_period_in_name_given_extension():
    filepath = "test.1.jpg"
    extension = filepath[-4:]
    parsed_extension = _parse_and_validate_extension(Path(filepath), extension,
                                                     {".jpg": None})
    assert parsed_extension == extension
Example #10
0
def test_parse_period_in_name_double_no_extension():
    filepath = 'test.1.pkl.gz'
    extension = filepath[-7:]
    parsed_extension = _parse_and_validate_extension(Path(filepath), extension,
                                                     {'.pkl.gz': None})
    assert parsed_extension == extension
Example #11
0
def test_parse_mot_matching_extension_raises_ValueError():
    filepath = "test.jpg2"
    with raises(ValueError):
        _parse_and_validate_extension(Path(filepath), ".jpg", {".jpg": None})
Example #12
0
def test_parse_period_in_name_no_extension():
    filepath = 'test.1.jpg'
    extension = filepath[-4:]
    parsed_extension = _parse_and_validate_extension(Path(filepath), None,
                                                     {'.jpg': None})
    assert parsed_extension == extension
Example #13
0
def test_parse_double_extension_given_extension():
    filepath = 'test.pkl.gz'
    extension = filepath[-7:]
    parsed_extension = _parse_and_validate_extension(Path(filepath), extension,
                                                     {'.pkl.gz': None})
    assert parsed_extension == extension
Example #14
0
def test_parse_extension_no_given_extension():
    filepath = 'test.jpg'
    extension = filepath[-4:]
    parsed_extension = _parse_and_validate_extension(Path(filepath), None,
                                                     {'.jpg': None})
    assert parsed_extension == extension
Example #15
0
def test_parse_mot_matching_extension_raises_ValueError():
    filepath = 'test.jpg2'
    _parse_and_validate_extension(Path(filepath), '.jpg', {'.jpg': None})
Example #16
0
def test_parse_unknown_extension_raises_ValueError():
    filepath = 'test.1.fake'
    _parse_and_validate_extension(Path(filepath), None, {'.jpg': None})