Exemplo n.º 1
0
def test_stitch_limit_number_of_tiles(load):
    load.side_effect = _dummy_load()

    too_many_tiles = {(x, y): 'http://dummy.com/({}_{}).png'.format(x, y)
                      for x, y in cartesian_product(range(10), range(5))}

    with pytest.raises(StitchException):
        stitch(too_many_tiles, 'RGB')
Exemplo n.º 2
0
def test_stitch_with_no_tiles(load):
    load.side_effect = lambda paths: dict()

    dummy_paths = {(x, y): 'http://dummy.com/({}_{}).png'.format(x, y)
                   for x, y in cartesian_product(range(0, 3), range(0, 4))}

    with pytest.raises(StitchException):
        stitch(dummy_paths, 'RGB')
Exemplo n.º 3
0
def test_stitch_some_missing_tiles(load):
    load.side_effect = _dummy_load(exclude_tiles=((0, 0), (1, 2)))

    dummy_paths = {(x, y): 'http://dummy.com/({}_{}).png'.format(x, y)
                   for x, y in cartesian_product(range(0, 3), range(0, 4))}

    actual = stitch(dummy_paths, 'RGB')
    expected = Image.open(
        path_of_test_resource('imgs/missingtiles_stitch_result.jpg'), 'r')
    return actual, expected
Exemplo n.º 4
0
def test_stitch_tempdir_intermediate(save):
    save.side_effect = _dummy_save()

    dummy_paths = {(x, y): 'http://dummy.com/({}_{}).png'.format(x, y)
                   for x, y in cartesian_product(range(2, 5), range(3, 7))}

    actual = stitch(dummy_paths, 'RGB', tempfiles=True)
    expected = Image.open(
        path_of_test_resource('imgs/happypath_stitch_result.jpg'), 'r')
    return actual, expected
Exemplo n.º 5
0
def test_stitch_inmemory(load):
    load.side_effect = _dummy_load()

    dummy_paths = {(x, y): 'http://dummy.com/({}_{}).png'.format(x, y)
                   for x, y in cartesian_product(range(2, 5), range(3, 7))}

    actual = stitch(dummy_paths, 'RGB')
    expected = Image.open(
        path_of_test_resource('imgs/happypath_stitch_result.jpg'), 'r')
    return actual, expected
Exemplo n.º 6
0
def test_stitch_with_missing_column(load):
    exclude = [(0, i) for i in range(4)]
    load.side_effect = _dummy_load(exclude_tiles=exclude)

    dummy_paths = {(x, y): 'http://dummy.com/({}_{}).png'.format(x, y)
                   for x, y in cartesian_product(range(0, 3), range(0, 4))}

    actual = stitch(dummy_paths, 'RGB')
    expected = Image.open(
        path_of_test_resource('imgs/missingcolumn_stitch_result.jpg'), 'r')
    return actual, expected