diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-10 11:51:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-10 11:51:09 +0100 |
commit | 552384fa977901dcbc33cc999cd38dddcdc0eef1 (patch) | |
tree | a3324faee94ed843f55621a30490a2c33bd3d478 /tests/gis_tests | |
parent | 72efd840a8cb6ee35a3732d8bb434e7361970b3c (diff) | |
download | django-552384fa977901dcbc33cc999cd38dddcdc0eef1.tar.gz |
Refs #31014 -- Added FromWKB and FromWKT GIS database functions.
Co-authored-by: Ondřej Böhm <ondrej.bohm@firma.seznam.cz>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
Diffstat (limited to 'tests/gis_tests')
-rw-r--r-- | tests/gis_tests/geoapp/test_functions.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py index 535e552aa1..59b0410aca 100644 --- a/tests/gis_tests/geoapp/test_functions.py +++ b/tests/gis_tests/geoapp/test_functions.py @@ -326,6 +326,24 @@ class GISFunctionsTests(FuncTestMixin, TestCase): ).get(name="Foo") self.assertEqual(rhr_rings, st.force_polygon_cw.coords) + @skipUnlessDBFeature("has_FromWKB_function") + def test_fromwkb(self): + g = Point(56.811078, 60.608647) + g2 = City.objects.values_list( + functions.FromWKB(Value(g.wkb.tobytes())), + flat=True, + )[0] + self.assertIs(g.equals_exact(g2, 0.00001), True) + + @skipUnlessDBFeature("has_FromWKT_function") + def test_fromwkt(self): + g = Point(56.811078, 60.608647) + g2 = City.objects.values_list( + functions.FromWKT(Value(g.wkt)), + flat=True, + )[0] + self.assertIs(g.equals_exact(g2, 0.00001), True) + @skipUnlessDBFeature("has_GeoHash_function") def test_geohash(self): # Reference query: |