

def test_2dsphere_linestring_sets_correctly(self):

    class Location(Document):
        line = LineStringField()
    Location.drop_collection()
    Location(line=[[1, 2], [2, 2]]).save()
    loc = Location.objects.as_pymongo()[0]
    self.assertEqual(loc['line'], {
        'type': 'LineString',
        'coordinates': [[1, 2], [2, 2]],
    })
    Location.objects.update(set__line=[[2, 1], [1, 2]])
    loc = Location.objects.as_pymongo()[0]
    loc.assertEqual(loc['line'], {
        'type': 'LineString',
        'coordinates': [[2, 1], [1, 2]],
    })

dataset/ETHPy150Open MongoEngine/mongoengine/tests/queryset/geo.py GeoQueriesTest.test_2dsphere_linestring_sets_correctly/VarMisuse@140/167 `self`->`loc`