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

@ -6,7 +6,7 @@ Changes in v0.4
===============
- Added ``SortedListField``
- Added ``EmailField``
- Added ``GeoLocationField``
- Added ``GeoPointField``
- Added ``exact`` and ``iexact`` match operators to ``QuerySet``
- Added ``get_document_or_404`` and ``get_list_or_404`` Django shortcuts
- Fixed bug in Q-objects

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__':

View File

@ -1175,8 +1175,6 @@ class QuerySetTest(unittest.TestCase):
def __unicode__(self):
return self.title
meta = {'geo_indexes': ["location"]}
Event.drop_collection()
event1 = Event(title="Coltrane Motion @ Double Door",