diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2017-04-02 23:24:06 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-04-02 14:24:06 -0400 |
| commit | 5e710cf4a5dba1fc30e3b6775b83c2218e57cd36 (patch) | |
| tree | 7c6f74edfb1861d6305178e6ddce5e9807ca1702 /tests | |
| parent | 4f99ba84b3efd4b33721288cbbe1a605c7f937fd (diff) | |
Fixed #11854 -- Added Azimuth GIS function. (#8286)
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): |
