示例#1
0
def test_slice_idx_generator_raises():
    """Test convert.slice_idx_generator raises StopIteration.

    The given shape (4305, 9791) breaks iterative schemes that don't properly
    seperate tiles. Was a bug.
    """
    shape = (250, 250)
    zoom = 5
    tile_size = 256

    with pytest.raises(StopIteration) as excinfo:
        given = convert.slice_idx_generator(shape, zoom, tile_size)

    assert excinfo
示例#2
0
def test_slice_idx_generator_z2():
    """Test convert.slice_idx_generator at zoom level 2.

    The given shape (4305, 9791) breaks iterative schemes that don't properly
    seperate tiles. Was a bug.
    """
    shape = (4305, 9791)
    zoom = 2
    tile_size = 256
    given = convert.slice_idx_generator(shape, zoom, tile_size)
    expected = helpers.get_slice_idx_generator_solution(zoom)

    comparable_given = set(map(helpers.covert_idx_to_hashable_tuple, given))
    comparable_expected = set(
        map(helpers.covert_idx_to_hashable_tuple, expected))

    assert comparable_given == comparable_expected