[Python-modules-commits] [djangorestframework-gis] 01/06: Assert that the coordinates are approximately equal instead af absolutely equal.
Michael Fladischer
fladi at moszumanska.debian.org
Tue Oct 27 16:00:10 UTC 2015
This is an automated email from the git hooks/post-receive script.
fladi pushed a commit to branch master
in repository djangorestframework-gis.
commit 54b385ce3b58632ac82c40b3419a07b4a6dce1ac
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date: Tue Oct 27 09:39:24 2015 +0100
Assert that the coordinates are approximately equal instead af absolutely equal.
This is necessary because spatialite, which is used by the unittests in the
Debian package, yields a lower precision when it comes to floating point
coordinates compared to PostgreSQL.
---
tests/django_restframework_gis_tests/tests.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tests/django_restframework_gis_tests/tests.py b/tests/django_restframework_gis_tests/tests.py
index c7e4470..6ef8201 100644
--- a/tests/django_restframework_gis_tests/tests.py
+++ b/tests/django_restframework_gis_tests/tests.py
@@ -132,10 +132,8 @@ class TestRestFrameworkGis(TestCase):
expected_coords = (6.381495826183805, 53.384066927384985)
self.assertEqual(response.status_code, 201)
self.assertEqual(Location.objects.count(), 1)
- self.assertEquals(
- Location.objects.get(name='EWKT input test').geometry.coords,
- expected_coords
- )
+ for l, e in zip(Location.objects.get(name='EWKT input test').geometry.coords, expected_coords):
+ self.assertAlmostEqual(l, e, places=5)
def test_post_location_list_WKT_as_json(self):
self.assertEqual(Location.objects.count(), 0)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/djangorestframework-gis.git
More information about the Python-modules-commits
mailing list