Loading tests/gis_tests/geos_tests/test_geos.py +19 −30 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ from django.contrib.gis.geos import ( ) from django.contrib.gis.geos.base import GEOSBase from django.contrib.gis.shortcuts import numpy from django.test import mock from django.utils import six from django.utils.encoding import force_bytes from django.utils.six.moves import range Loading Loading @@ -896,7 +897,6 @@ class GEOSTest(unittest.TestCase, TestDataMixin): """ Testing `transform` method (SRID match) """ # transform() should no-op if source & dest SRIDs match, # regardless of whether GDAL is available. if gdal.HAS_GDAL: g = GEOSGeometry('POINT (-104.609 38.255)', 4326) gt = g.tuple g.transform(4326) Loading @@ -909,10 +909,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): self.assertEqual(g1.srid, 4326) self.assertIsNot(g1, g, "Clone didn't happen") old_has_gdal = gdal.HAS_GDAL try: gdal.HAS_GDAL = False with mock.patch('django.contrib.gis.gdal.HAS_GDAL', False): g = GEOSGeometry('POINT (-104.609 38.255)', 4326) gt = g.tuple g.transform(4326) Loading @@ -924,8 +921,6 @@ class GEOSTest(unittest.TestCase, TestDataMixin): self.assertEqual(g1.tuple, g.tuple) self.assertEqual(g1.srid, 4326) self.assertIsNot(g1, g, "Clone didn't happen") finally: gdal.HAS_GDAL = old_has_gdal def test_transform_nosrid(self): """ Testing `transform` method (no SRID or negative SRID) """ Loading @@ -942,20 +937,14 @@ class GEOSTest(unittest.TestCase, TestDataMixin): g = GEOSGeometry('POINT (-104.609 38.255)', srid=-1) self.assertRaises(GEOSException, g.transform, 2774, clone=True) @skipUnless(HAS_GDAL, "GDAL is required.") @mock.patch('django.contrib.gis.gdal.HAS_GDAL', False) def test_transform_nogdal(self): """ Testing `transform` method (GDAL not available) """ old_has_gdal = gdal.HAS_GDAL try: gdal.HAS_GDAL = False g = GEOSGeometry('POINT (-104.609 38.255)', 4326) self.assertRaises(GEOSException, g.transform, 2774) g = GEOSGeometry('POINT (-104.609 38.255)', 4326) self.assertRaises(GEOSException, g.transform, 2774, clone=True) finally: gdal.HAS_GDAL = old_has_gdal def test_extent(self): "Testing `extent` method." Loading Loading
tests/gis_tests/geos_tests/test_geos.py +19 −30 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ from django.contrib.gis.geos import ( ) from django.contrib.gis.geos.base import GEOSBase from django.contrib.gis.shortcuts import numpy from django.test import mock from django.utils import six from django.utils.encoding import force_bytes from django.utils.six.moves import range Loading Loading @@ -896,7 +897,6 @@ class GEOSTest(unittest.TestCase, TestDataMixin): """ Testing `transform` method (SRID match) """ # transform() should no-op if source & dest SRIDs match, # regardless of whether GDAL is available. if gdal.HAS_GDAL: g = GEOSGeometry('POINT (-104.609 38.255)', 4326) gt = g.tuple g.transform(4326) Loading @@ -909,10 +909,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): self.assertEqual(g1.srid, 4326) self.assertIsNot(g1, g, "Clone didn't happen") old_has_gdal = gdal.HAS_GDAL try: gdal.HAS_GDAL = False with mock.patch('django.contrib.gis.gdal.HAS_GDAL', False): g = GEOSGeometry('POINT (-104.609 38.255)', 4326) gt = g.tuple g.transform(4326) Loading @@ -924,8 +921,6 @@ class GEOSTest(unittest.TestCase, TestDataMixin): self.assertEqual(g1.tuple, g.tuple) self.assertEqual(g1.srid, 4326) self.assertIsNot(g1, g, "Clone didn't happen") finally: gdal.HAS_GDAL = old_has_gdal def test_transform_nosrid(self): """ Testing `transform` method (no SRID or negative SRID) """ Loading @@ -942,20 +937,14 @@ class GEOSTest(unittest.TestCase, TestDataMixin): g = GEOSGeometry('POINT (-104.609 38.255)', srid=-1) self.assertRaises(GEOSException, g.transform, 2774, clone=True) @skipUnless(HAS_GDAL, "GDAL is required.") @mock.patch('django.contrib.gis.gdal.HAS_GDAL', False) def test_transform_nogdal(self): """ Testing `transform` method (GDAL not available) """ old_has_gdal = gdal.HAS_GDAL try: gdal.HAS_GDAL = False g = GEOSGeometry('POINT (-104.609 38.255)', 4326) self.assertRaises(GEOSException, g.transform, 2774) g = GEOSGeometry('POINT (-104.609 38.255)', 4326) self.assertRaises(GEOSException, g.transform, 2774, clone=True) finally: gdal.HAS_GDAL = old_has_gdal def test_extent(self): "Testing `extent` method." Loading