#NEWLINE# @ async_test #NEWLINE# def testMultiple( self ) : #NEWLINE# #INDENT# 'Tests that multiple allocations from the same sequence do\n    not overlap.\n    ' #NEWLINE# allocs = [ IdAllocator ( 'type' ) , IdAllocator ( 'type' ) ] #NEWLINE# num_ids = 3000 #NEWLINE# def _OnAllocated( id_lists ) : #NEWLINE# #INDENT# assert ( len ( id_lists ) == 2 ) #NEWLINE# id_set1 = set ( id_lists [ 0 ] ) #NEWLINE# id_set2 = set ( id_lists [ 1 ] ) #NEWLINE# assert ( len ( id_set1 ) == 3000 ) #NEWLINE# assert ( len ( id_set2 ) == 3000 ) #NEWLINE# assert id_set1 . isdisjoint ( id_set2 ) #NEWLINE# self . stop ( ) #NEWLINE# #UNINDENT# with util . ArrayBarrier ( _OnAllocated ) as b : #NEWLINE# #INDENT# with util . ArrayBarrier ( b . Callback ( ) ) as b1 : #NEWLINE# #INDENT# [ allocs [ 0 ] . NextId ( self . _client , b1 . Callback ( ) ) for i in xrange ( num_ids ) ] #NEWLINE# #UNINDENT# with util . ArrayBarrier ( b . Callback ( ) ) as b2 : #NEWLINE# #INDENT# [ allocs [ 1 ] . NextId ( self . _client , b2 . Callback ( ) ) for i in xrange ( num_ids ) ]