diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/geoapp/test_functions.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py index ff6d1db9a8..6e4a87f212 100644 --- a/tests/gis_tests/geoapp/test_functions.py +++ b/tests/gis_tests/geoapp/test_functions.py @@ -1,4 +1,5 @@ import json +import math import re from decimal import Decimal @@ -145,6 +146,15 @@ class GISFunctionsTests(TestCase): self.assertEqual(svg1, City.objects.annotate(svg=functions.AsSVG('point')).get(name='Pueblo').svg) self.assertEqual(svg2, City.objects.annotate(svg=functions.AsSVG('point', relative=5)).get(name='Pueblo').svg) + @skipUnlessDBFeature("has_Azimuth_function") + def test_azimuth(self): + # Returns the azimuth in radians. + azimuth_expr = functions.Azimuth(Point(0, 0, srid=4326), Point(1, 1, srid=4326)) + self.assertAlmostEqual(City.objects.annotate(azimuth=azimuth_expr).first().azimuth, math.pi / 4) + # Returns None if the two points are coincident. + azimuth_expr = functions.Azimuth(Point(0, 0, srid=4326), Point(0, 0, srid=4326)) + self.assertIsNone(City.objects.annotate(azimuth=azimuth_expr).first().azimuth) + @skipUnlessDBFeature("has_BoundingCircle_function") def test_bounding_circle(self): def circle_num_points(num_seg): |
