#NEWLINE# def test_summary_complex_arith( bank ) : #NEWLINE# #INDENT# expr = by ( t . name , arith = ( 100 - ( ( t . amount * 2 ) / 30.0 ) ) . sum ( ) ) #NEWLINE# result = compute ( expr , bank ) #NEWLINE# reducer = ( lambda acc , x : ( ( 100 - ( ( x [ 'amount' ] * 2 ) / 30.0 ) ) + acc ) ) #NEWLINE# expected = reduceby ( 'name' , reducer , bank . find ( ) , 0 ) #NEWLINE# assert ( set ( reducer ) == set ( expected . items ( ) ) )