#NEWLINE# @ mock . patch . object ( types . MutableList , 'changed' ) #NEWLINE# def test_changed_on_setitem( self , m ) : #NEWLINE# #INDENT# sample = [ 1 , 2 , 3 ] #NEWLINE# lst = types . MutableList ( m ) #NEWLINE# lst [ 2 ] = 4 #NEWLINE# self . assertEqual ( [ 1 , 2 , 4 ] , lst ) #NEWLINE# self . assertEqual ( 1 , m . call_count )