'Ensure that an embedded document is properly returned from
different manners of querying.'

def test_find_embedded(self):

    class User(EmbeddedDocument, ):
        name = StringField()
    class BlogPost(Document, ):
        content = StringField()
        author = EmbeddedDocumentField(User)
    BlogPost.drop_collection()
    user = User(name='Test    User')
    BlogPost.objects.create(author=user, content='Had    a    good    coffee    today...')
    result = BlogPost.objects.first()
    self.assertTrue(isinstance(result.author, User))
    self.assertEqual(result.author.name, 'Test    User')
    result = BlogPost.objects.get(author__name=user.name)
    self.assertTrue(isinstance(result.author, User))
    self.assertEqual(result.author.name, 'Test    User')
    result = BlogPost.objects.get(author={'name': user.name})
    self.assertTrue(isinstance(result.author, User))
    self.assertEqual(result.author.name, 'Test    User')
    with self.assertRaises(InvalidQueryError):
        BlogPost.objects.get(author=user.name)
