'Ensure that ListField works with standard list operators that manipulate the list.'

def test_list_field_manipulative_operators(self):

    class BlogPost(Document, ):
        ref = StringField()
        info = ListField(StringField())
    BlogPost.drop_collection()
    post = BlogPost()
    post.ref = '1234'
    post.info = ['0', '1', '2', '3', '4', '5']
    post.save()
    def reset_post():
        post.info = ['0', '1', '2', '3', '4', '5']
        post.save()
    reset_post()
    temp = ['a', 'b']
    post.info = (post.info + temp)
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', 'a', 'b'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', 'a', 'b'])
    reset_post()
    del post.info[2]
    self.assertEqual(post.info, ['0', '1', '3', '4', '5'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '3', '4', '5'])
    reset_post()
    del post.info[1:3]
    self.assertEqual(post.info, ['0', '3', '4', '5'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '3', '4', '5'])
    reset_post()
    temp = ['a', 'b']
    post.info += temp
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', 'a', 'b'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', 'a', 'b'])
    reset_post()
    post.info *= 2
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', '0', '1', '2', '3', '4', '5'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', '0', '1', '2', '3', '4', '5'])
    reset_post()
    post.info = (post.info * 2)
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', '0', '1', '2', '3', '4', '5'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', '0', '1', '2', '3', '4', '5'])
    reset_post()
    post.info = (2 * post.info)
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', '0', '1', '2', '3', '4', '5'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', '0', '1', '2', '3', '4', '5'])
    reset_post()
    post.info[4] = 'a'
    self.assertEqual(post.info, ['0', '1', '2', '3', 'a', '5'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '2', '3', 'a', '5'])
    reset_post()
    post.info[(-2)] = 'a'
    self.assertEqual(post.info, ['0', '1', '2', '3', 'a', '5'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '2', '3', 'a', '5'])
    reset_post()
    post.info[1:3] = ['h', 'e', 'l', 'l', 'o']
    self.assertEqual(post.info, ['0', 'h', 'e', 'l', 'l', 'o', '3', '4', '5'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', 'h', 'e', 'l', 'l', 'o', '3', '4', '5'])
    reset_post()
    post.info[(-5):(-3)] = ['h', 'e', 'l', 'l', 'o']
    self.assertEqual(post.info, ['0', 'h', 'e', 'l', 'l', 'o', '3', '4', '5'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', 'h', 'e', 'l', 'l', 'o', '3', '4', '5'])
    reset_post()
    post.info.append('h')
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', 'h'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', 'h'])
    reset_post()
    post.info.extend(['h', 'e', 'l', 'l', 'o'])
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', 'h', 'e', 'l', 'l', 'o'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '2', '3', '4', '5', 'h', 'e', 'l', 'l', 'o'])
    reset_post()
    x = post.info.pop(2)
    y = post.info.pop()
    self.assertEqual(post.info, ['0', '1', '3', '4'])
    self.assertEqual(x, '2')
    self.assertEqual(y, '5')
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '3', '4'])
    reset_post()
    post.info.remove('2')
    self.assertEqual(post.info, ['0', '1', '3', '4', '5'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['0', '1', '3', '4', '5'])
    reset_post()
    post.info.reverse()
    self.assertEqual(post.info, ['5', '4', '3', '2', '1', '0'])
    post.save()
    post.reload()
    self.assertEqual(post.info, ['5', '4', '3', '2', '1', '0'])
