#NEWLINE# def test__replace_one_upsert( self ) : #NEWLINE# #INDENT# self . assert_document_count ( 0 ) #NEWLINE# result = self . db . collection . replace_one ( { #NEWLINE# #INDENT# 'a' : 2 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'x' : 1 , #NEWLINE# 'y' : 2 , #NEWLINE# #UNINDENT# } , upsert = True ) #NEWLINE# self . assertEqual ( result . matched_count , 0 ) #NEWLINE# self . assertEqual ( result . modified_count , 0 ) #NEWLINE# self . assertIsNotNone ( self . upserted_id ) #NEWLINE# self . assert_document_stored ( result . upserted_id , { #NEWLINE# #INDENT# 'x' : 1 , #NEWLINE# 'y' : 2 , #NEWLINE# #UNINDENT# } )