diff options
| author | QuentinAndre <quentin.andre@imt-atlantique.net> | 2021-07-06 18:58:53 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-10-25 12:06:02 +0200 |
| commit | b32ed5df8445c54094d870f8031b312c1816e89d (patch) | |
| tree | 342d30b0bef5981bb91db1568e5f9fb64bd93f03 /archaeological_finds/tests.py | |
| parent | a05222260de530d44980931badc2db41fe4b6cb6 (diff) | |
| download | Ishtar-b32ed5df8445c54094d870f8031b312c1816e89d.tar.bz2 Ishtar-b32ed5df8445c54094d870f8031b312c1816e89d.zip | |
test + geo_get_items
Diffstat (limited to 'archaeological_finds/tests.py')
| -rw-r--r-- | archaeological_finds/tests.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 8cac07812..51da0d879 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -2535,6 +2535,20 @@ class GeomaticTest(FindInit, TestCase): base_find = models.BaseFind.objects.get(pk=base_find.pk) + # with point + geom = GEOSGeometry("POINT({} {} {})".format(2, 43, 1), srid=4326) + base_find.point = geom + base_find.multi_polygon = None + base_find.save() + base_find = models.BaseFind.objects.get(pk=base_find.pk) + dic = {"centroid": (2.0, 43.0)} + res = base_find.get_geo_items(get_polygons=True) + self.assertEqual(dic, res) + res = base_find.get_geo_items(get_polygons=False) + self.assertEqual(dic, res) + + # with multi-polygon + base_find = models.BaseFind.objects.get(pk=base_find.pk) limit = ( "MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2))," "((6 3,9 2,9 4,6 3)))" |
