#NEWLINE# def test___hash__call( self ) : #NEWLINE# #INDENT# hash_called = [ ] #NEWLINE# class Bar ( object ) : #NEWLINE# #INDENT# def __hash__( self ) : #NEWLINE# #INDENT# hash = object . __hash__ ( self ) #NEWLINE# hash_called . append ( hash ) #NEWLINE# return hash #NEWLINE# #UNINDENT# #UNINDENT# bar = Bar ( ) #NEWLINE# ref = weakref . ref ( bar ) #NEWLINE# self . assertFalse ( hash_called ) #NEWLINE# hash ( ref ) #NEWLINE# self . assertEqual ( len ( hash_called ) , 1 ) #NEWLINE# hash ( ref ) #NEWLINE# self . assertEqual ( len ( hash_called ) , 1 ) #NEWLINE# self . assertEqual ( hash ( bar ) , hash ( ref ) ) #NEWLINE# self . assertEqual ( len ( hash_called ) , 2 )