Beispiel #1
0
def _test_write_image(prefix, path):
    data = open(path).read()
    assert coverlib.write_image(data, prefix) != None

    def exists(filename):
        return os.path.exists(coverlib.find_image_path(filename))

    assert exists(prefix + '.jpg')
    assert exists(prefix + '-S.jpg')
    assert exists(prefix + '-M.jpg')
    assert exists(prefix + '-L.jpg')

    assert open(coverlib.find_image_path(prefix + '.jpg')).read() == data
def _test_write_image(prefix, path):
    data = open(path).read()
    assert coverlib.write_image(data, prefix) != None
    
    def exists(filename):
        return os.path.exists(coverlib.find_image_path(filename))
    
    assert exists(prefix + '.jpg')
    assert exists(prefix + '-S.jpg')
    assert exists(prefix + '-M.jpg')
    assert exists(prefix + '-L.jpg')
    
    assert open(coverlib.find_image_path(prefix + '.jpg')).read() == data
Beispiel #3
0
def test_write_image(prefix, path, image_dir):
    """Test writing jpg, gif and png images"""
    data = open(join(static_dir, path)).read()
    assert coverlib.write_image(data, prefix) is not None

    def _exists(filename):
        return exists(coverlib.find_image_path(filename))

    assert _exists(prefix + '.jpg')
    assert _exists(prefix + '-S.jpg')
    assert _exists(prefix + '-M.jpg')
    assert _exists(prefix + '-L.jpg')

    assert open(coverlib.find_image_path(prefix + '.jpg')).read() == data
def test_write_image(prefix, path, image_dir):
    """Test writing jpg, gif and png images"""
    data = open(join(static_dir, path)).read()
    assert coverlib.write_image(data, prefix) is not None

    def _exists(filename):
        return exists(coverlib.find_image_path(filename))

    assert _exists(prefix + '.jpg')
    assert _exists(prefix + '-S.jpg')
    assert _exists(prefix + '-M.jpg')
    assert _exists(prefix + '-L.jpg')

    assert open(coverlib.find_image_path(prefix + '.jpg')).read() == data
Beispiel #5
0
def test_bad_image(image_dir):
    prefix = config.data_root + '/bad'
    assert coverlib.write_image('', prefix) == None

    prefix = config.data_root + '/bad'
    assert coverlib.write_image('not an image', prefix) == None
def test_bad_image():
    prefix = config.data_root + '/bad'
    assert coverlib.write_image('', prefix) == None

    prefix = config.data_root + '/bad'
    assert coverlib.write_image('not an image', prefix) == None