1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Removed redundant database vendor helpers in gis_tests/utils.py.

This commit is contained in:
Tim Graham
2020-11-14 09:08:30 -05:00
committed by Mariusz Felisiak
parent 9f91122ed8
commit e3ece0144a
12 changed files with 71 additions and 88 deletions

View File

@@ -4,8 +4,6 @@ from django.db import connection
from django.test import TestCase, skipUnlessDBFeature
from django.utils.functional import cached_property
from .utils import oracle, postgis, spatialite
test_srs = ({
'srid': 4326,
'auth_name': ('EPSG', True),
@@ -75,13 +73,15 @@ class SpatialRefSysTest(TestCase):
# also, Oracle Spatial seems to add extraneous info to fields, hence the
# the testing with the 'startswith' flag.
auth_name, oracle_flag = sd['auth_name']
if postgis or (oracle and oracle_flag):
self.assertTrue(srs.auth_name.startswith(auth_name))
# Compare case-insensitively because srs.auth_name is lowercase
# ("epsg") on Spatialite.
if not connection.ops.oracle or oracle_flag:
self.assertIs(srs.auth_name.upper().startswith(auth_name), True)
self.assertEqual(sd['auth_srid'], srs.auth_srid)
# No PROJ and different srtext on oracle backends :(
if postgis:
# No PROJ and different srtext on Oracle.
if not connection.ops.oracle:
self.assertTrue(srs.wkt.startswith(sd['srtext']))
self.assertRegex(srs.proj4text, sd['proj_re'])
@@ -94,14 +94,9 @@ class SpatialRefSysTest(TestCase):
self.assertTrue(sr.spheroid.startswith(sd['spheroid']))
self.assertEqual(sd['geographic'], sr.geographic)
self.assertEqual(sd['projected'], sr.projected)
if not (spatialite and not sd['spatialite']):
# Can't get 'NAD83 / Texas South Central' from PROJ string
# on SpatiaLite
self.assertTrue(sr.name.startswith(sd['name']))
self.assertIs(sr.name.startswith(sd['name']), True)
# Testing the SpatialReference object directly.
if postgis or spatialite:
if not connection.ops.oracle:
srs = sr.srs
self.assertRegex(srs.proj, sd['proj_re'])
self.assertTrue(srs.wkt.startswith(sd['srtext']))