

def test_2dsphere_point_sets_correctly(self):

    class Location(Document):
        loc = PointField()
    Location.drop_collection()
    Location(loc=[1, 2]).save()
    loc = Location.objects.as_pymongo()[0]
    self.assertEqual(loc['loc'], {
        'type': 'Point',
        'coordinates': [1, 2],
    })
    Location.objects.update(set__loc=[2, 1])
    loc = Location.objects.as_pymongo()[0]
    self.assertEqual(loc['loc'], {
        'type': 'Point',
        'coordinates': [2, 1],
    })

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