Added tests for GeometryField.deconstruct().
This commit is contained in:
parent
194a4b526c
commit
7b9f8e38bb
|
@ -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,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue