#NEWLINE# def test_polymorphic_queries( self ) : #NEWLINE# #INDENT# 'Ensure that the correct subclasses are returned from a query\n        ' #NEWLINE# class Animal ( Document ) : #NEWLINE# #INDENT# meta = { #NEWLINE# #INDENT# 'allow_inheritance' : True , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# class Fish ( Animal ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class Mammal ( Animal ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class Dog ( Mammal ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class Human ( Mammal ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# Animal . drop_collection ( ) #NEWLINE# Animal ( ) . save ( ) #NEWLINE# Fish ( ) . save ( ) #NEWLINE# Mammal ( ) . save ( ) #NEWLINE# Dog ( ) . save ( ) #NEWLINE# Human ( ) . save ( ) #NEWLINE# classes = [ obj . __class__ for obj in Animal . objects ] #NEWLINE# self . assertEqual ( classes , [ Animal , Fish , Mammal , Dog , Human ] ) #NEWLINE# classes = [ obj . __class__ for obj in Mammal . objects ] #NEWLINE# self . assertEqual ( classes , [ Mammal , Dog , Human ] ) #NEWLINE# classes = [ obj . __class__ for obj in Human . objects ] #NEWLINE# self . assertEqual ( classes , [ Human ] )