From 7b9f8e38bb68f4c906ccbc1e991913ec2ba67f43 Mon Sep 17 00:00:00 2001 From: jtiai Date: Fri, 21 Dec 2018 17:41:11 -0500 Subject: [PATCH] Added tests for GeometryField.deconstruct(). --- tests/gis_tests/test_fields.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/gis_tests/test_fields.py b/tests/gis_tests/test_fields.py index 27db3e1dfa..215b9f9a25 100644 --- a/tests/gis_tests/test_fields.py +++ b/tests/gis_tests/test_fields.py @@ -1,5 +1,6 @@ import copy +from django.contrib.gis.db.models.fields import GeometryField from django.contrib.gis.db.models.sql import AreaField, DistanceField from django.test import SimpleTestCase @@ -13,3 +14,23 @@ class FieldsTests(SimpleTestCase): def test_distance_field_deepcopy(self): field = DistanceField(None) self.assertEqual(copy.deepcopy(field), field) + + +class GeometryFieldTests(SimpleTestCase): + def test_deconstruct_empty(self): + field = GeometryField() + *_, kwargs = field.deconstruct() + self.assertEqual(kwargs, {'srid': 4326}) + + def test_deconstruct_values(self): + field = GeometryField( + srid=4067, + dim=3, + geography=True, + ) + *_, kwargs = field.deconstruct() + self.assertEqual(kwargs, { + 'srid': 4067, + 'dim': 3, + 'geography': True, + })