diff options
author | QuentinAndre <quentin.andre@imt-atlantique.net> | 2021-07-06 18:58:53 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-09-01 12:36:45 +0200 |
commit | 79cff7a266fc1dd4abf4ca749a60fda30dee49d1 (patch) | |
tree | 0dfb3a8244cc4b24a72c94cb03c8061a5bd01e32 /archaeological_finds/tests.py | |
parent | 168f9a17ffefb4e95d34b394d39537d70210ae84 (diff) | |
download | Ishtar-79cff7a266fc1dd4abf4ca749a60fda30dee49d1.tar.bz2 Ishtar-79cff7a266fc1dd4abf4ca749a60fda30dee49d1.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 07e93be96..4e237673a 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -2517,6 +2517,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)))" |