'Ensure that list types work as expected.'

def test_list_field(self):

    class BlogPost(Document, ):
        info = ListField()
    BlogPost.drop_collection()
    post = BlogPost()
    post.info = 'my    post'
    self.assertRaises(ValidationError, post.validate)
    post.info = {'title': 'test'}
    self.assertRaises(ValidationError, post.validate)
    post.info = ['test']
    post.save()
    post = BlogPost()
    post.info = [{'test': 'test'}]
    post.save()
    post = BlogPost()
    post.info = [{'test': 3}]
    post.save()
    self.assertEqual(BlogPost.objects.count(), 3)
    self.assertEqual(BlogPost.objects.filter(info__exact='test').count(), 1)
    self.assertEqual(BlogPost.objects.filter(info__0__test='test').count(), 1)
    self.assertEqual(BlogPost.objects.filter(info__0__test__exact='5').count(), 0)
    self.assertEqual(BlogPost.objects.filter(info__100__test__exact='test').count(), 0)
    post = BlogPost()
    post.info = ['1', '2']
    post.save()
    post = BlogPost.objects(info=['1', '2']).get()
    post.info += ['3', '4']
    post.save()
    self.assertEqual(BlogPost.objects(info=['1', '2', '3', '4']).count(), 1)
    post = BlogPost.objects(info=['1', '2', '3', '4']).get()
    post.info *= 2
    post.save()
    self.assertEqual(BlogPost.objects(info=['1', '2', '3', '4', '1', '2', '3', '4']).count(), 1)
