#NEWLINE# def init_expected_db( self , test , result ) : #NEWLINE# #INDENT# for cmd in test [ 'assert' ] . get ( 'data' , [ ] ) : #NEWLINE# #INDENT# for key in cmd . keys ( ) : #NEWLINE# #INDENT# if ( key in _COMMANDS ) : #NEWLINE# #INDENT# for doc in cmd . get ( 'documents' , [ ] ) : #NEWLINE# #INDENT# keylist = doc . keys ( ) #NEWLINE# for dockey in copy . deepcopy ( list ( keylist ) ) : #NEWLINE# #INDENT# if ( 'result' in str ( doc [ dockey ] ) ) : #NEWLINE# #INDENT# doc [ dockey ] = result #NEWLINE# #UNINDENT# if ( 'actual' in str ( doc [ dockey ] ) ) : #NEWLINE# #INDENT# doc . pop ( dockey ) #NEWLINE# #UNINDENT# if ( dockey == 'contentType' ) : #NEWLINE# #INDENT# doc [ 'metadata' ] = { #NEWLINE# #INDENT# dockey : doc . pop ( dockey ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# coll = self . db . get_collection ( cmd [ key ] ) #NEWLINE# _COMMANDS [ key ] ( coll , cmd ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( test [ 'assert' ] . get ( 'result' ) == '&result' ) : #NEWLINE# #INDENT# test [ 'assert' ] [ 'result' ] = result