2323from rasterio .crs import CRS
2424from rasterio .io import MemoryFile
2525from rio_tiler .colormap import cmap as default_cmap
26- from rio_tiler .errors import NoOverviewWarning
26+ from rio_tiler .errors import InvalidDatatypeWarning , NoOverviewWarning
2727from rio_tiler .io import BaseReader , MultiBandReader , Reader , STACReader
2828from starlette .requests import Request
2929from starlette .testclient import TestClient
@@ -279,7 +279,7 @@ def test_TilerFactory():
279279 assert meta ["driver" ] == "WMTS"
280280 assert meta ["crs" ] == "EPSG:3857"
281281 root = ET .fromstring (response .content )
282- assert root
282+ assert root is not None
283283
284284 response = client .get (
285285 f"/WebMercatorQuad/WMTSCapabilities.xml?url={ DATA_DIR } /cog.tif&bdix=1&rescale=0,1000"
@@ -290,7 +290,7 @@ def test_TilerFactory():
290290 assert meta ["driver" ] == "WMTS"
291291 assert meta ["crs" ] == "EPSG:3857"
292292 root = ET .fromstring (response .content )
293- assert root
293+ assert root is not None
294294
295295 response = client .get (
296296 f"/WorldCRS84Quad/WMTSCapabilities.xml?url={ DATA_DIR } /cog.tif&minzoom=5&maxzoom=12"
@@ -301,7 +301,7 @@ def test_TilerFactory():
301301 assert meta ["driver" ] == "WMTS"
302302 assert str (meta ["crs" ]) == "OGC:CRS84"
303303 root = ET .fromstring (response .content )
304- assert root
304+ assert root is not None
305305
306306 response = client .get (f"/bounds?url={ DATA_DIR } /cog.tif" )
307307 assert response .status_code == 200
@@ -321,7 +321,9 @@ def test_TilerFactory():
321321 assert "bbox" in response .json ()
322322 assert response .json ()["geometry" ]["type" ] == "Polygon"
323323
324- response = client .get (f"/info.geojson?url={ DATA_DIR } /cog_dateline.tif" )
324+ # BBOX crossing the Antimeridian
325+ with pytest .warns (UserWarning ):
326+ response = client .get (f"/info.geojson?url={ DATA_DIR } /cog_dateline.tif" )
325327 assert response .status_code == 200
326328 assert response .headers ["content-type" ] == "application/geo+json"
327329 assert response .json ()["type" ] == "Feature"
@@ -415,9 +417,10 @@ def test_TilerFactory():
415417 assert meta ["dtype" ] == "uint16"
416418 assert meta ["count" ] == 2
417419
418- response = client .post (
419- f"/feature/100x100.jpeg?url={ DATA_DIR } /cog.tif" , json = feature
420- )
420+ with pytest .warns (InvalidDatatypeWarning ):
421+ response = client .post (
422+ f"/feature/100x100.jpeg?url={ DATA_DIR } /cog.tif" , json = feature
423+ )
421424 assert response .status_code == 200
422425 assert response .headers ["content-type" ] == "image/jpeg"
423426 meta = parse_img (response .content )
@@ -785,9 +788,11 @@ def test_MultiBaseTilerFactory(rio):
785788 assert len (response .json ()["bounds" ]) == 4
786789 assert response .json ()["crs" ]
787790
788- response = client .get (f"/info?url={ DATA_DIR } /item.json" )
789- assert response .status_code == 200
790- assert len (response .json ()) == 2
791+ # no assets
792+ with pytest .warns (UserWarning ):
793+ response = client .get (f"/info?url={ DATA_DIR } /item.json" )
794+ assert response .status_code == 200
795+ assert len (response .json ()) == 2
791796
792797 response = client .get (f"/info?url={ DATA_DIR } /item.json&assets=B01&assets=B09" )
793798 assert response .status_code == 200
@@ -1169,7 +1174,9 @@ def test_MultiBandTilerFactory():
11691174 assert response .json () == ["B01" , "B09" ]
11701175
11711176 # default bands
1172- response = client .get (f"/info?directory={ DATA_DIR } " )
1177+ # no bands
1178+ with pytest .warns (UserWarning ):
1179+ response = client .get (f"/info?directory={ DATA_DIR } " )
11731180 assert response .json ()["band_metadata" ] == [["B01" , {}], ["B09" , {}]]
11741181
11751182 response = client .get (f"/info?directory={ DATA_DIR } &bands=B01" )
@@ -1626,7 +1633,8 @@ def test_TilerFactory_WithGdalEnv():
16261633 app .include_router (router )
16271634 client = TestClient (app )
16281635
1629- response = client .get (f"/info?url={ DATA_DIR } /non_cog.tif" )
1636+ with pytest .warns (NoOverviewWarning ):
1637+ response = client .get (f"/info?url={ DATA_DIR } /non_cog.tif" )
16301638 assert not response .json ()["overviews" ]
16311639
16321640 router = TilerFactory (
0 commit comments