#NEWLINE# def test_find_one( self ) : #NEWLINE# #INDENT# for instance in self . instances : #NEWLINE# #INDENT# instance . save ( ) #NEWLINE# #UNINDENT# instance = self . TestModel . find_one ( { #NEWLINE# #INDENT# 'id' : self . instances [ 0 ] . id , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( instance , self . instances [ 0 ] ) #NEWLINE# instance = self . TestModel . find_one ( { #NEWLINE# #INDENT# 'foo' : 'hello' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( instance , self . instances [ 1 ] ) #NEWLINE# instance = self . TestModel . find_one ( { #NEWLINE# #INDENT# 'bar' : 'hi' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( instance , instance . instances [ 0 ] ) #NEWLINE# instance = self . TestModel . find_one ( { #NEWLINE# #INDENT# 'baz' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( instance , self . instances [ 0 ] ) #NEWLINE# instance = self . TestModel . find_one ( { #NEWLINE# #INDENT# 'baz' : 'nope' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertTrue ( ( instance is None ) )