diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2018-01-27 11:12:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-27 11:12:11 +0100 |
commit | b002a032f90b8cd228cfcee6c88cd238a8191cc0 (patch) | |
tree | ba2229bbf9a92f5b45e30e1377610ca572ed616f /tests/gis_tests/geos_tests | |
parent | 3187c89d6f8c60ca7e78093d5b37e0709e71cea9 (diff) | |
download | django-b002a032f90b8cd228cfcee6c88cd238a8191cc0.tar.gz |
Fixed #29054 -- Fixed a regression where a queryset that annotates with geometry objects crashes.
Made GEOSGeometryBase hashable.
Regression in 19b2dfd1bfe7fd716dd3d8bfa5f972070d83b42f.
Thanks Tim Graham for the review.
Diffstat (limited to 'tests/gis_tests/geos_tests')
-rw-r--r-- | tests/gis_tests/geos_tests/test_geos.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py index db8c44d758..0c0197f8c1 100644 --- a/tests/gis_tests/geos_tests/test_geos.py +++ b/tests/gis_tests/geos_tests/test_geos.py @@ -187,6 +187,22 @@ class GEOSTest(SimpleTestCase, TestDataMixin): self.assertNotEqual(g, {'foo': 'bar'}) self.assertNotEqual(g, False) + def test_hash(self): + point_1 = Point(5, 23) + point_2 = Point(5, 23, srid=4326) + point_3 = Point(5, 23, srid=32632) + multipoint_1 = MultiPoint(point_1, srid=4326) + multipoint_2 = MultiPoint(point_2) + multipoint_3 = MultiPoint(point_3) + self.assertNotEqual(hash(point_1), hash(point_2)) + self.assertNotEqual(hash(point_1), hash(point_3)) + self.assertNotEqual(hash(point_2), hash(point_3)) + self.assertNotEqual(hash(multipoint_1), hash(multipoint_2)) + self.assertEqual(hash(multipoint_2), hash(multipoint_3)) + self.assertNotEqual(hash(multipoint_1), hash(point_1)) + self.assertNotEqual(hash(multipoint_2), hash(point_2)) + self.assertNotEqual(hash(multipoint_3), hash(point_3)) + def test_eq_with_srid(self): "Testing non-equivalence with different srids." p0 = Point(5, 23) |