#NEWLINE# def test_concurrent_capture_and_eject_unclaimed_balls( self ) : #NEWLINE# #INDENT# playfield = self . machine . ball_devices [ 'playfield' ] #NEWLINE# coil5 = self . machine . coils [ 'eject_coil5' ] #NEWLINE# coil5 . pulse = MagicMock ( ) #NEWLINE# self . machine . events . add_handler ( 'balldevice_captured_from_playfield' , self . _captured_from_pf ) #NEWLINE# self . _captured = 0 #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_target3' , 1 ) #NEWLINE# self . advance_time_and_run ( 0.1 ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_target3_2' , 1 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 2 , self . _captured ) #NEWLINE# self . _captured = 0 #NEWLINE# coil5 . pulse . assert_called_once_with ( ) #NEWLINE# coil5 . pulse = MagicMock ( ) #NEWLINE# self . advance_time_and_run ( 0.1 ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_target3' , 0 ) #NEWLINE# self . advance_time_and_run ( 11 ) #NEWLINE# self . assertEquals ( 1 , playfield . balls ) #NEWLINE# coil5 . pulse . assert_called_once_with ( ) #NEWLINE# coil5 . pulse = MagicMock ( ) #NEWLINE# self . advance_time_and_run ( 0.1 ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_target3_2' , 0 ) #NEWLINE# self . advance_time_and_run ( 11 ) #NEWLINE# self . assertEquals ( 2 , playfield . balls ) #NEWLINE# self . assertEquals ( 0 , self . _captured )