mirror of
https://github.com/rasterio/rasterio.git
synced 2025-12-08 17:36:12 +00:00
The signatures of all cdef class initializers in rasterio._base and rasterio._io have changed: these method now take instance of ParsedPath or UnparsedPath from rasterio.path and do not take strings. New ParsedPath and UnparsedPath classes have been added to improve input file handling and validation. The existing parse_path and vsi_path functions have been rewritten to use these new classes and have been moved to the new rasterio.path module. The signature of rasterio.open has not been changed and users of Rasterio will be unaffected. The rasterio.vfs module and its functions are being replaced by new functions in rasterio.path.
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
import pytest
|
|
|
|
from rasterio.errors import RasterioDeprecationWarning
|
|
from rasterio.vfs import parse_path, vsi_path
|
|
|
|
|
|
def test_vsi_path():
|
|
"""Warn deprecation of old vsi_path"""
|
|
with pytest.warns(RasterioDeprecationWarning):
|
|
assert vsi_path('/foo.tif', 'tests/data/files.zip', 'zip') == '/vsizip/tests/data/files.zip/foo.tif'
|
|
|
|
|
|
def test_vsi_unparsed_path():
|
|
"""Warn deprecation of old vsi_path"""
|
|
with pytest.warns(RasterioDeprecationWarning):
|
|
assert vsi_path('foo.tif', None, None) == 'foo.tif'
|
|
|
|
|
|
def test_parse_path():
|
|
"""Warn deprecation of old parse_path"""
|
|
with pytest.warns(RasterioDeprecationWarning):
|
|
assert parse_path('foo.tif') == ('foo.tif', None, None)
|
|
|
|
|
|
def test_parse_path_with_vfs():
|
|
"""Warn deprecation of old parse_path"""
|
|
with pytest.warns(RasterioDeprecationWarning):
|
|
assert parse_path('foo.tif', vfs='zip://tests/data/files.zip') == ('foo.tif', 'tests/data/files.zip', 'zip')
|
|
|
|
|
|
def test_parse_path_vsi():
|
|
"""Warn deprecation of old parse_path"""
|
|
with pytest.warns(RasterioDeprecationWarning):
|
|
assert parse_path('/vsifoo/bar.tif') == ('/vsifoo/bar.tif', None, None)
|