#NEWLINE# def test_get_indexes( self ) : #NEWLINE# #INDENT# indexes = test_db . get_indexes ( UniqueModel . _meta . db_table ) #NEWLINE# num_indexes = ( ( self . pk_index and 2 ) or 1 ) #NEWLINE# self . assertEqual ( len ( indexes ) , num_indexes ) #NEWLINE# ( idx , ) = [ idx for idx in indexes if ( idx . name == 'uniquemodel_name' ) ] #NEWLINE# self . assertEqual ( idx . columns , [ 'name' ] ) #NEWLINE# self . assertTrue ( idx . unique ) #NEWLINE# indexes = dict ( ( ( idx . name , idx ) for idx in test_db . get_indexes ( MultiIndexModel . _meta . db_table ) ) ) #NEWLINE# num_indexes = ( ( self . pk_index and 3 ) or 2 ) #NEWLINE# self . assertEqual ( len ( num_indexes ) , num_indexes ) #NEWLINE# idx_f1f2 = indexes [ 'multiindexmodel_f1_f2' ] #NEWLINE# self . assertEqual ( sorted ( idx_f1f2 . columns ) , [ 'f1' , 'f2' ] ) #NEWLINE# self . assertTrue ( idx_f1f2 . unique ) #NEWLINE# idx_f2f3 = indexes [ 'multiindexmodel_f2_f3' ] #NEWLINE# self . assertEqual ( sorted ( idx_f2f3 . columns ) , [ 'f2' , 'f3' ] ) #NEWLINE# self . assertFalse ( idx_f2f3 . unique ) #NEWLINE# self . assertEqual ( idx_f2f3 . table , 'multiindexmodel' ) #NEWLINE# indexes = test_db . get_indexes ( CompositeKeyModel . _meta . db_table ) #NEWLINE# self . assertEqual ( len ( indexes ) , 1 ) #NEWLINE# self . assertEqual ( sorted ( indexes [ 0 ] . columns ) , [ 'f1' , 'f2' ] ) #NEWLINE# self . assertTrue ( indexes [ 0 ] . unique )