Beispiel #1
0
def test_export_disk_invalid_scheme(tmpdir):
    tpk = TPK("tests/data/states_filled.tpk")
    path = str(tmpdir.join("tiles"))

    with pytest.raises(ValueError):
        tpk.to_disk(path, scheme="bad")

    tpk.close()
Beispiel #2
0
def test_export_disk_mixed_format(tmpdir):
    tpk = TPK("tests/data/states_filled.tpk")
    tpk.format = "mixed"  # this is a hack to make test fail, need a test file for this

    path = str(tmpdir.join("tiles"))

    with pytest.raises(ValueError):
        tpk.to_disk(path)

    tpk.close()
Beispiel #3
0
def test_export_disk_int_zoom(tmpdir):
    tpk = TPK("tests/data/states_filled.tpk")
    path = str(tmpdir.join("tiles"))

    tpk.to_disk(path, zoom=1)
    tpk.close()

    assert os.path.exists(path)
    assert os.path.exists(os.path.join(path, "1/0/0.png"))
    assert not os.path.exists(os.path.join(path, "0/0/0.png"))
Beispiel #4
0
def test_export_disk_existing_output(tmpdir):
    tpk = TPK("tests/data/states_filled.tpk")
    path = str(tmpdir.join("tiles"))
    os.makedirs(path)
    with open(os.path.join(path, "test.txt"), "w") as outfile:
        outfile.write("Foo")

    with pytest.raises(IOError):
        tpk.to_disk(path)

    tpk.close()
Beispiel #5
0
def test_export_disk_existing_output(tmpdir):
    tpk = TPK('tests/data/states_filled.tpk')
    path = str(tmpdir.join('tiles'))
    os.makedirs(path)
    with open(os.path.join(path, 'test.txt'), 'w') as outfile:
        outfile.write('Foo')

    with pytest.raises(IOError):
        tpk.to_disk(path)

    tpk.close()