Loading django/contrib/gis/geos/geometry.py +2 −3 Original line number Diff line number Diff line Loading @@ -376,9 +376,8 @@ class GEOSGeometry(GEOSBase, ListMixin): @property def ewkt(self): """ Returns the EWKT (WKT + SRID) of the Geometry. Note that Z values are *not* included in this representation because GEOS does not yet support serializing them. Returns the EWKT (SRID + WKT) of the Geometry. Note that Z values are only included in this representation if GEOS >= 3.3.0. """ if self.get_srid(): return 'SRID=%s;%s' % (self.srid, self.wkt) Loading django/contrib/gis/tests/geoapp/tests.py +20 −0 Original line number Diff line number Diff line from __future__ import unicode_literals import re from tempfile import NamedTemporaryFile import unittest from django.db import connection from django.contrib.gis import gdal from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.tests.utils import no_oracle, oracle, postgis, spatialite from django.core.management import call_command from django.test import TestCase, skipUnlessDBFeature from django.utils import six Loading Loading @@ -203,6 +205,24 @@ class GeoModelTest(TestCase): self.assertEqual(len(cities1), len(list(cities2))) self.assertIsInstance(cities2[0].point, Point) def test_dumpdata_loaddata_cycle(self): """ Test a dumpdata/loaddata cycle with geographic data. """ out = six.StringIO() original_data = list(City.objects.all().order_by('name')) call_command('dumpdata', 'geoapp.City', stdout=out) result = out.getvalue() houston = City.objects.get(name='Houston') self.assertIn('"point": "%s"' % houston.point.wkt, result) # Reload now dumped data with NamedTemporaryFile(mode='w', suffix='.json') as tempfile: tempfile.write(result) tempfile.seek(0) call_command('loaddata', tempfile.name, verbosity=0) self.assertListEqual(original_data, list(City.objects.all().order_by('name'))) @skipUnlessDBFeature("gis_enabled") class GeoLookupTest(TestCase): Loading Loading
django/contrib/gis/geos/geometry.py +2 −3 Original line number Diff line number Diff line Loading @@ -376,9 +376,8 @@ class GEOSGeometry(GEOSBase, ListMixin): @property def ewkt(self): """ Returns the EWKT (WKT + SRID) of the Geometry. Note that Z values are *not* included in this representation because GEOS does not yet support serializing them. Returns the EWKT (SRID + WKT) of the Geometry. Note that Z values are only included in this representation if GEOS >= 3.3.0. """ if self.get_srid(): return 'SRID=%s;%s' % (self.srid, self.wkt) Loading
django/contrib/gis/tests/geoapp/tests.py +20 −0 Original line number Diff line number Diff line from __future__ import unicode_literals import re from tempfile import NamedTemporaryFile import unittest from django.db import connection from django.contrib.gis import gdal from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.tests.utils import no_oracle, oracle, postgis, spatialite from django.core.management import call_command from django.test import TestCase, skipUnlessDBFeature from django.utils import six Loading Loading @@ -203,6 +205,24 @@ class GeoModelTest(TestCase): self.assertEqual(len(cities1), len(list(cities2))) self.assertIsInstance(cities2[0].point, Point) def test_dumpdata_loaddata_cycle(self): """ Test a dumpdata/loaddata cycle with geographic data. """ out = six.StringIO() original_data = list(City.objects.all().order_by('name')) call_command('dumpdata', 'geoapp.City', stdout=out) result = out.getvalue() houston = City.objects.get(name='Houston') self.assertIn('"point": "%s"' % houston.point.wkt, result) # Reload now dumped data with NamedTemporaryFile(mode='w', suffix='.json') as tempfile: tempfile.write(result) tempfile.seek(0) call_command('loaddata', tempfile.name, verbosity=0) self.assertListEqual(original_data, list(City.objects.all().order_by('name'))) @skipUnlessDBFeature("gis_enabled") class GeoLookupTest(TestCase): Loading