#NEWLINE# def test_threaded_access_property( self ) : #NEWLINE# #INDENT# called = collections . deque ( ) #NEWLINE# class A ( object ) : #NEWLINE# #INDENT# @ misc . cachedproperty #NEWLINE# def b( self ) : #NEWLINE# #INDENT# called . append ( 1 ) #NEWLINE# time . sleep ( ( random . random ( ) * 0.5 ) ) #NEWLINE# return 'b' #NEWLINE# #UNINDENT# #UNINDENT# a = A ( ) #NEWLINE# threads = [ ] #NEWLINE# try : #NEWLINE# #INDENT# for _i in range ( 0 , 20 ) : #NEWLINE# #INDENT# t = threading_utils . daemon_thread ( ( lambda : a . b ) ) #NEWLINE# threads . append ( t ) #NEWLINE# #UNINDENT# for t in threads : #NEWLINE# #INDENT# t . start ( ) #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# while threads : #NEWLINE# #INDENT# t = threads . pop ( ) #NEWLINE# t . join ( ) #NEWLINE# #UNINDENT# #UNINDENT# self . assertEqual ( 1 , len ( called ) ) #NEWLINE# self . assertEqual ( 'b' , a . b )