mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 02:41:09 +00:00
@@ -2,11 +2,13 @@ import unittest
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import json
|
import json
|
||||||
from pmtiles.writer import Writer
|
from pmtiles.writer import Writer
|
||||||
from pmtiles.reader import Reader, MemorySource
|
from pmtiles.reader import Reader, MemorySource
|
||||||
from pmtiles.convert import (
|
from pmtiles.convert import (
|
||||||
pmtiles_to_mbtiles,
|
pmtiles_to_mbtiles,
|
||||||
|
pmtiles_to_dir,
|
||||||
mbtiles_to_pmtiles,
|
mbtiles_to_pmtiles,
|
||||||
mbtiles_to_header_json,
|
mbtiles_to_header_json,
|
||||||
)
|
)
|
||||||
@@ -27,6 +29,10 @@ class TestConvert(unittest.TestCase):
|
|||||||
os.remove("test_tmp_2.mbtiles")
|
os.remove("test_tmp_2.mbtiles")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
try:
|
||||||
|
shutil.rmtree("test_dir")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def test_roundtrip(self):
|
def test_roundtrip(self):
|
||||||
with open("test_tmp.pmtiles", "wb") as f:
|
with open("test_tmp.pmtiles", "wb") as f:
|
||||||
@@ -68,6 +74,8 @@ class TestConvert(unittest.TestCase):
|
|||||||
|
|
||||||
mbtiles_to_pmtiles("test_tmp.mbtiles", "test_tmp_2.pmtiles", 3)
|
mbtiles_to_pmtiles("test_tmp.mbtiles", "test_tmp_2.pmtiles", 3)
|
||||||
|
|
||||||
|
pmtiles_to_dir("test_tmp.pmtiles","test_dir")
|
||||||
|
|
||||||
def test_mbtiles_header(self):
|
def test_mbtiles_header(self):
|
||||||
header, json_metadata = mbtiles_to_header_json(
|
header, json_metadata = mbtiles_to_header_json(
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user