Remove unused pathlib import and reformat

This commit is contained in:
Sean Gillies 2023-01-11 09:59:01 -07:00
parent 8111307a75
commit 2807d5c201
2 changed files with 7 additions and 10 deletions

View File

@ -325,6 +325,7 @@ class VirtualDataset:
# To avoid a circular import.
from rasterio.io import MemoryFile
# TODO: consider implications of calling open a second time.
self._memfile = MemoryFile(ET.tostring(self._tree))
return self._memfile.open(driver="VRT", sharing=sharing, **kwargs)

View File

@ -1,14 +1,12 @@
"""Tests of the rasterio.vrt module"""
from pathlib import Path
import rasterio
import rasterio.vrt
from rasterio.vrt import _boundless_vrt_doc, VirtualDataset
def test_boundless_vrt(path_rgb_byte_tif):
with rasterio.open(path_rgb_byte_tif) as rgb:
doc = rasterio.vrt._boundless_vrt_doc(rgb)
doc = _boundless_vrt_doc(rgb)
assert doc.startswith("<VRTDataset")
with rasterio.open(doc) as vrt:
assert rgb.count == vrt.count
@ -18,7 +16,7 @@ def test_boundless_vrt(path_rgb_byte_tif):
def test_boundless_msk_vrt(path_rgb_msk_byte_tif):
with rasterio.open(path_rgb_msk_byte_tif) as msk:
doc = rasterio.vrt._boundless_vrt_doc(msk)
doc = _boundless_vrt_doc(msk)
assert doc.startswith("<VRTDataset")
with rasterio.open(doc) as vrt:
assert msk.count == vrt.count
@ -28,17 +26,15 @@ def test_boundless_msk_vrt(path_rgb_msk_byte_tif):
def test_virtual_dataset_fromstring(path_rgb_byte_tif):
with rasterio.open(path_rgb_byte_tif) as rgb:
doc = rasterio.vrt._boundless_vrt_doc(rgb)
doc = _boundless_vrt_doc(rgb)
with rasterio.vrt.VirtualDataset.fromstring(
doc
) as vrtfile, vrtfile.open() as vrt:
with VirtualDataset.fromstring(doc) as vrtfile, vrtfile.open() as vrt:
assert rgb.count == vrt.count
assert rgb.dtypes == vrt.dtypes
assert rgb.mask_flag_enums == vrt.mask_flag_enums
def test_virtual_dataset_constructor():
vrt = rasterio.vrt.VirtualDataset(height=10, width=11)
vrt = VirtualDataset(height=10, width=11)
assert vrt.height == 10
assert vrt.width == 11