diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/rasterapp/test_rasterfield.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/gis_tests/rasterapp/test_rasterfield.py b/tests/gis_tests/rasterapp/test_rasterfield.py index 63a6325135..2a6fe09f6a 100644 --- a/tests/gis_tests/rasterapp/test_rasterfield.py +++ b/tests/gis_tests/rasterapp/test_rasterfield.py @@ -8,7 +8,7 @@ from django.contrib.gis.geos import GEOSGeometry from django.contrib.gis.measure import D from django.contrib.gis.shortcuts import numpy from django.db import connection -from django.db.models import Q +from django.db.models import F, Func, Q from django.test import TransactionTestCase, skipUnlessDBFeature from django.test.utils import CaptureQueriesContext @@ -51,6 +51,26 @@ class RasterFieldTest(TransactionTestCase): qs = RasterModel.objects.all() qs[0].rast.bands[0].data() + def test_deserialize_with_pixeltype_flags(self): + no_data = 3 + rast = GDALRaster({ + 'srid': 4326, + 'origin': [0, 0], + 'scale': [-1, 1], + 'skew': [0, 0], + 'width': 1, + 'height': 1, + 'nr_of_bands': 1, + 'bands': [{'data': [no_data], 'nodata_value': no_data}], + }) + r = RasterModel.objects.create(rast=rast) + RasterModel.objects.filter(pk=r.pk).update( + rast=Func(F('rast'), function='ST_SetBandIsNoData'), + ) + r.refresh_from_db() + self.assertEquals(r.rast.bands[0].data(), [[no_data]]) + self.assertEquals(r.rast.bands[0].nodata_value, no_data) + def test_model_creation(self): """ Test RasterField through a test model. |
