

def test_2dsphere_point_embedded(self):

    class Venue(EmbeddedDocument):
        location = GeoPointField()
        name = StringField()

    class Event(Document):
        title = StringField()
        venue = EmbeddedDocumentField(Venue)
    Event.drop_collection()
    venue1 = Venue(name='The Rock', location=[(- 87.677137), 41.909889])
    venue2 = Venue(name='The Bridge', location=[(- 122.4194155), 37.7749295])
    event1 = Event(title='Coltrane Motion @ Double Door', venue=venue1).save()
    event2 = Event(title='Coltrane Motion @ Bottom of the Hill', venue=venue2).save()
    event3 = Event(title='Coltrane Motion @ Empty Bottle', venue=venue1).save()
    events = Event.objects(venue__location__near=[(- 87.67892), 41.9120459])
    self.assertEqual(events.count(), 3)
    self.assertEqual(list(events), [event1, event3, event2])

dataset/ETHPy150Open MongoEngine/mongoengine/tests/queryset/geo.py GeoQueriesTest.test_2dsphere_point_embedded/original