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

@ -1,12 +1,9 @@
from unittest import skipUnless
from django.contrib.gis.db.models import F, GeometryField, Value, functions
from django.contrib.gis.geos import Point, Polygon
from django.db import connection
from django.db.models import Count, Min
from django.test import TestCase, skipUnlessDBFeature
from ..utils import postgis
from .models import City, ManyPointModel, MultiFields
@ -25,7 +22,7 @@ class GeoExpressionsTests(TestCase):
self.assertTrue(point.equals_exact(p.transform(4326, clone=True), 10 ** -5))
self.assertEqual(point.srid, 4326)
@skipUnless(postgis, 'Only postgis has geography fields.')
@skipUnlessDBFeature('supports_geography')
def test_geography_value(self):
p = Polygon(((1, 1), (1, 2), (2, 2), (2, 1), (1, 1)))
area = City.objects.annotate(a=functions.Area(Value(p, GeometryField(srid=4326, geography=True)))).first().a