#NEWLINE# def test_model_factory( self ) : #NEWLINE# #INDENT# class Category ( BaseExtModel ) : #NEWLINE# #INDENT# name = CharField ( ) #NEWLINE# parent = ForeignKeyField ( 'self' , null = True ) #NEWLINE# #UNINDENT# Closure = ClosureTable ( Category ) #NEWLINE# self . assertEqual ( Closure . _meta . extension_module , 'transitive_closure' ) #NEWLINE# self . assertEqual ( Closure . _meta . columns , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( Closure . _meta . fields , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertFalse ( Closure . _meta . primary_key ) #NEWLINE# self . assertEqual ( Closure . _meta . extension_options , { #NEWLINE# #INDENT# 'idcolumn' : 'id' , #NEWLINE# 'parentcolumn' : 'parent_id' , #NEWLINE# 'tablename' : 'category' , #NEWLINE# #UNINDENT# } ) #NEWLINE# class Alt ( BaseExtModel ) : #NEWLINE# #INDENT# pk = PrimaryKeyField ( ) #NEWLINE# ref = ForeignKeyField ( 'self' , null = True ) #NEWLINE# #UNINDENT# Closure = ClosureTable ( Alt ) #NEWLINE# self . assertEqual ( self . _meta . columns , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( Closure . _meta . fields , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertFalse ( Closure . _meta . primary_key ) #NEWLINE# self . assertEqual ( Closure . _meta . extension_options , { #NEWLINE# #INDENT# 'idcolumn' : 'pk' , #NEWLINE# 'parentcolumn' : 'ref_id' , #NEWLINE# 'tablename' : 'alt' , #NEWLINE# #UNINDENT# } ) #NEWLINE# class NoForeignKey ( BaseExtModel ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . assertRaises ( ValueError , ClosureTable , NoForeignKey )