#NEWLINE# def test_first_return_first_result( self ) : #NEWLINE# #INDENT# builder = self . get_builder ( ) #NEWLINE# query = 'SELECT * FROM "users" WHERE "id" = ? LIMIT 1' #NEWLINE# results = [ { #NEWLINE# #INDENT# 'foo' : 'bar' , #NEWLINE# #UNINDENT# } ] #NEWLINE# builder . get_connection ( ) . select . return_value = results #NEWLINE# builder . get_processor ( ) . process_select = mock . MagicMock ( side_effect = ( lambda builder_ , results_ : results ) ) #NEWLINE# result = builder . from_ ( 'users' ) . where ( 'id' , '=' , 1 ) . first ( ) #NEWLINE# builder . get_connection ( ) . select . assert_called_once_with ( query , [ 1 ] , True ) #NEWLINE# builder . get_processor ( ) . process_select . assert_called_once_with ( builder , results ) #NEWLINE# self . assertEqual ( result , results [ 0 ] )