Exemple #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()
Exemple #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()
Exemple #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"))
Exemple #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()
Exemple #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()