forked from developmentseed/titiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update and test TileJSON model (developmentseed#363)
- Loading branch information
1 parent
9774b88
commit 216e5b1
Showing
5 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""test titiler.models.""" | ||
|
||
import pytest | ||
from pydantic import ValidationError | ||
|
||
from titiler.core.models.mapbox import TileJSON | ||
|
||
|
||
def test_tilejson_model(): | ||
"""Make sure TileJSON model validates input and return default.""" | ||
tj = TileJSON(tiles=["https://something.xyz/{x}/{y}/{z}"]) | ||
assert tj.center == (0.0, 0.0, 0) | ||
assert tj.bounds == [-180, -90, 180, 90] | ||
assert tj.minzoom == 0 | ||
assert tj.maxzoom == 30 | ||
assert tj.scheme == "xyz" | ||
|
||
tj = TileJSON( | ||
tiles=["https://something.xyz/{x}/{y}/{z}"], center=(10, 10, 4), scheme="tms" | ||
) | ||
assert tj.center == (10.0, 10.0, 4) | ||
assert tj.bounds == [-180, -90, 180, 90] | ||
assert tj.scheme == "tms" | ||
|
||
with pytest.raises(ValidationError): | ||
TileJSON(tiles=["https://something.xyz/{x}/{y}/{z}"], scheme="abc") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters