Added test for Geo indexes

This commit is contained in:
Harry Marr
2010-07-07 15:12:14 +01:00
parent 71689fcf23
commit c2163ecee5
3 changed files with 19 additions and 3 deletions

View File

@@ -607,6 +607,24 @@ class FieldTest(unittest.TestCase):
Shirt.drop_collection()
def test_geo_indexes(self):
"""Ensure that indexes are created automatically for GeoPointFields.
"""
class Event(Document):
title = StringField()
location = GeoPointField()
Event.drop_collection()
event = Event(title="Coltrane Motion @ Double Door",
location=[41.909889, -87.677137])
event.save()
info = Event.objects._collection.index_information()
self.assertTrue(u'location_2d' in info)
self.assertTrue(info[u'location_2d'] == [(u'location', u'2d')])
Event.drop_collection()
if __name__ == '__main__':