'Ensure that the \'push\' update with position works properly.'

@needs_mongodb_v26
def test_update_push_with_position(self):

    class BlogPost(Document, ):
        slug = StringField()
        tags = ListField(StringField())
    BlogPost.drop_collection()
    post = BlogPost.objects.create(slug='test')
    BlogPost.objects.filter(id=post.id).update(push__tags='code')
    BlogPost.objects.filter(id=post.id).update(push__tags__0=['mongodb', 'python'])
    post.reload()
    self.assertEqual(post.tags, ['mongodb', 'python', 'code'])
    BlogPost.objects.filter(id=post.id).update(set__tags__2='java')
    post.reload()
    self.assertEqual(post.tags, ['mongodb', 'python', 'java'])
    BlogPost.objects.filter(id=post.id).update(push__tags__0='scala')
    post.reload()
    self.assertEqual(post.tags, ['scala', 'mongodb', 'python', 'java'])
