#NEWLINE# def test_counter( ) : #NEWLINE# #INDENT# 'Test Counter replacement' #NEWLINE# import collections #NEWLINE# try : #NEWLINE# #INDENT# Counter = collections . Counter #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# a = Counter ( [ 1 , 2 , 1 , 3 ] ) #NEWLINE# b = _Counter ( [ 1 , 2 , 1 , 3 ] ) #NEWLINE# c = _Counter ( ) #NEWLINE# c . update ( b ) #NEWLINE# for ( key , count ) in zip ( [ 1 , 2 , 3 ] , [ 2 , 1 , 1 ] ) : #NEWLINE# #INDENT# assert_equal ( a [ key ] , b [ key ] ) #NEWLINE# assert_equal ( a [ key ] , c [ key ] )