Exemplo n.º 1
0
def test_util_base_extension_in():
    assert extension_in('filename.txt', ['bat', 'txt'])
    assert extension_in('filename.biff', ['biff'])
    assert extension_in('filename.tar.gz', ['gz'])

    assert not extension_in('filename.txt', ['png', 'jpg'])
    assert not extension_in('.dotfile', ['bat', 'txt'])

    # Unintuitive, but that's how splitext works.
    assert not extension_in('filename.tar.gz', ['tar.gz'])
Exemplo n.º 2
0
def test_util_base_extension_in():
    assert extension_in("filename.txt", ["bat", "txt"])
    assert extension_in("filename.biff", ["biff"])
    assert extension_in("filename.tar.gz", ["gz"])

    assert not extension_in("filename.txt", ["png", "jpg"])
    assert not extension_in(".dotfile", ["bat", "txt"])

    # Unintuitive, but that's how splitext works.
    assert not extension_in("filename.tar.gz", ["tar.gz"])
Exemplo n.º 3
0
    def test_extension_in(self):
        assert_true(extension_in('filename.txt', ['bat', 'txt']))
        assert_true(extension_in('filename.biff', ['biff']))
        assert_true(extension_in('filename.tar.gz', ['gz']))

        assert_false(extension_in('filename.txt', ['png', 'jpg']))
        assert_false(extension_in('.dotfile', ['bat', 'txt']))

        # Unintuitive, but that's how splitext works.
        assert_false(extension_in('filename.tar.gz', ['tar.gz']))
Exemplo n.º 4
0
def test_util_base_extension_in():
    assert extension_in('filename.txt', ['bat', 'txt'])
    assert extension_in('filename.biff', ['biff'])
    assert extension_in('filename.tar.gz', ['gz'])

    assert not extension_in('filename.txt', ['png', 'jpg'])
    assert not extension_in('.dotfile', ['bat', 'txt'])

    # Unintuitive, but that's how splitext works.
    assert not extension_in('filename.tar.gz', ['tar.gz'])
Exemplo n.º 5
0
def is_asymmetric_resource(filename):
    """
    Return True if the filename's extension is an asymmetric Resource
    format.
    """
    return extension_in(filename, Resource.ASYMMETRIC_FORMATS)
Exemplo n.º 6
0
def is_source_resource(filename):
    """
    Return True if the filename's extension is a source-only Resource
    format.
    """
    return extension_in(filename, Resource.SOURCE_EXTENSIONS)
Exemplo n.º 7
0
def is_resource(filename):
    """
    Return True if the filename's extension is a supported Resource
    format.
    """
    return extension_in(filename, Resource.ALLOWED_EXTENSIONS)
Exemplo n.º 8
0
def is_asymmetric_resource(filename):
    """
    Return True if the filename's extension is an asymmetric Resource
    format.
    """
    return extension_in(filename, Resource.ASYMMETRIC_FORMATS)
Exemplo n.º 9
0
def is_source_resource(filename):
    """
    Return True if the filename's extension is a source-only Resource
    format.
    """
    return extension_in(filename, Resource.SOURCE_EXTENSIONS)
Exemplo n.º 10
0
def is_resource(filename):
    """
    Return True if the filename's extension is a supported Resource
    format.
    """
    return extension_in(filename, Resource.ALLOWED_EXTENSIONS)