Geo errors fix and test update
This commit is contained in:
parent
68f760b563
commit
473d5ead7b
@ -456,7 +456,7 @@ class GeoJsonBaseField(BaseField):
|
|||||||
if error and error not in errors:
|
if error and error not in errors:
|
||||||
errors.append(error)
|
errors.append(error)
|
||||||
if errors:
|
if errors:
|
||||||
return "Invalid Polygon:\n%s" % ", ".join(set(errors))
|
return "Invalid Polygon:\n%s" % ", ".join(errors)
|
||||||
|
|
||||||
def _validate_linestring(self, value, top_level=True):
|
def _validate_linestring(self, value, top_level=True):
|
||||||
"""Validates a linestring"""
|
"""Validates a linestring"""
|
||||||
@ -478,7 +478,7 @@ class GeoJsonBaseField(BaseField):
|
|||||||
if top_level:
|
if top_level:
|
||||||
return "Invalid LineString:\n%s" % ", ".join(errors)
|
return "Invalid LineString:\n%s" % ", ".join(errors)
|
||||||
else:
|
else:
|
||||||
return "%s" % ", ".join(set(errors))
|
return "%s" % ", ".join(errors)
|
||||||
|
|
||||||
def _validate_point(self, value):
|
def _validate_point(self, value):
|
||||||
"""Validate each set of coords"""
|
"""Validate each set of coords"""
|
||||||
|
@ -184,9 +184,9 @@ class GeoFieldTest(unittest.TestCase):
|
|||||||
polygon = PolygonField()
|
polygon = PolygonField()
|
||||||
|
|
||||||
geo_indicies = Event._geo_indices()
|
geo_indicies = Event._geo_indices()
|
||||||
self.assertEqual(geo_indicies, [{'fields': [('line', '2dsphere')]},
|
self.assertTrue({'fields': [('line', '2dsphere')]} in geo_indicies)
|
||||||
{'fields': [('polygon', '2dsphere')]},
|
self.assertTrue({'fields': [('polygon', '2dsphere')]} in geo_indicies)
|
||||||
{'fields': [('point', '2dsphere')]}])
|
self.assertTrue({'fields': [('point', '2dsphere')]} in geo_indicies)
|
||||||
|
|
||||||
def test_indexes_2dsphere_embedded(self):
|
def test_indexes_2dsphere_embedded(self):
|
||||||
"""Ensure that indexes are created automatically for GeoPointFields.
|
"""Ensure that indexes are created automatically for GeoPointFields.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user