mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #33866 -- Added pathlib.Path support to GDALRaster constructor.
This commit is contained in:
committed by
Mariusz Felisiak
parent
36cd425943
commit
2d23a07817
@@ -3,6 +3,7 @@ import shutil
|
||||
import struct
|
||||
import tempfile
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
from django.contrib.gis.gdal import GDALRaster, SpatialReference
|
||||
@@ -25,6 +26,11 @@ class GDALRasterTests(SimpleTestCase):
|
||||
)
|
||||
self.rs = GDALRaster(self.rs_path)
|
||||
|
||||
def test_gdalraster_input_as_path(self):
|
||||
rs_path = Path(__file__).parent.parent / "data" / "rasters" / "raster.tif"
|
||||
rs = GDALRaster(rs_path)
|
||||
self.assertEqual(str(rs_path), rs.name)
|
||||
|
||||
def test_rs_name_repr(self):
|
||||
self.assertEqual(self.rs_path, self.rs.name)
|
||||
self.assertRegex(repr(self.rs), r"<Raster object at 0x\w+>")
|
||||
|
||||
Reference in New Issue
Block a user