Пример #1
0
def test_MiniScale_cache(mini, image_mock):
    ts = ons.MiniScale()
    ts.filename = "mini_two.tif"
    tile = ts("SE 1234 43231")
    image_mock.reset_mock()
    ts("SD 1 2")
    assert image_mock.open.call_args_list == []

    ts.filename = "mini_one.tif"
    ts("SD 1 2")
    image_mock.open.assert_called_with(os.path.join("dirone", "mini_one.tif"))
Пример #2
0
def test_MiniScale(mini, image_mock):
    ts = ons.MiniScale()
    assert ts.tilesize == 1000
    assert ts.size_in_meters == 100000
    assert set(ts.filenames) == {"mini_one.tif", "mini_two.tif"}
    ts.filename = "mini_two.tif"
    assert ts.filename == "mini_two.tif"

    tile = ts("SE 1234 43231")
    image_mock.open.assert_called_with(os.path.join("dirtwo", "mini_two.tif"))
    image = image_mock.open.return_value
    image.crop.assert_called_with((4000, 8000, 5000, 9000))
    assert tile is image.crop.return_value

    assert ts.bounding_box == (0, 0, 700000, 1300000)