'Ensure that the correct subclasses are returned from a query'

def test_polymorphic_queries(self):

    class Animal(Document, ):
        meta = {'allow_inheritance': True}
    class Fish(Animal, ):
        pass
    class Mammal(Animal, ):
        pass
    class Dog(Mammal, ):
        pass
    class Human(Mammal, ):
        pass
    Animal.drop_collection()
    Animal().save()
    Fish().save()
    Mammal().save()
    Dog().save()
    Human().save()
    classes = [obj.__class__ for obj in Animal.objects]
    self.assertEqual(classes, [Animal, Fish, Mammal, Dog, Human])
    classes = [obj.__class__ for obj in Mammal.objects]
    self.assertEqual(classes, [Mammal, Dog, Human])
    classes = [obj.__class__ for obj in Human.objects]
    self.assertEqual(classes, [Human])
