diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2017-07-19 22:40:56 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-07-19 13:40:56 -0400 |
| commit | 3f7953846ee2e60a2cd56d6dea3b0ba9ffaa76c5 (patch) | |
| tree | 604960554d19deab1ee56fc8b4d59904dc4a13f0 /tests | |
| parent | 196da41ee2e0ff144d2de429a946da3e6674cc37 (diff) | |
Fixed typo in DistanceLookupBase.process_rhs() error message.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/distapp/tests.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/gis_tests/distapp/tests.py b/tests/gis_tests/distapp/tests.py index 30dbf4d8e1..8b8fb90c8c 100644 --- a/tests/gis_tests/distapp/tests.py +++ b/tests/gis_tests/distapp/tests.py @@ -140,15 +140,17 @@ class DistanceTest(TestCase): expected_cities.pop(0) self.assertEqual(expected_cities, self.get_names(dist_qs)) - # Too many params (4 in this case) should raise a ValueError. - queryset = AustraliaCity.objects.filter(point__distance_lte=('POINT(5 23)', D(km=100), 'spheroid', '4')) - with self.assertRaises(ValueError): - len(queryset) + msg = "2, 3, or 4-element tuple required for 'distance_lte' lookup." + with self.assertRaisesMessage(ValueError, msg): # Too many params. + len(AustraliaCity.objects.filter(point__distance_lte=('POINT(5 23)', D(km=100), 'spheroid', '4', None))) - # Not enough params should raise a ValueError. - with self.assertRaises(ValueError): + with self.assertRaisesMessage(ValueError, msg): # Too few params. len(AustraliaCity.objects.filter(point__distance_lte=('POINT(5 23)',))) + msg = "For 4-element tuples the last argument must be the 'spheroid' directive." + with self.assertRaisesMessage(ValueError, msg): + len(AustraliaCity.objects.filter(point__distance_lte=('POINT(5 23)', D(km=100), 'spheroid', '4'))) + # Getting all cities w/in 550 miles of Hobart. hobart = AustraliaCity.objects.get(name='Hobart') qs = AustraliaCity.objects.exclude(name='Hobart').filter(point__distance_lte=(hobart.point, D(mi=550))) |
