#NEWLINE# def test_ball_eject_timeout_and_ball_missing( self ) : #NEWLINE# #INDENT# self . _requesting = 0 #NEWLINE# coil2 = self . machine . coils [ 'eject_coil2' ] #NEWLINE# device2 = self . machine . ball_devices [ 'test_launcher' ] #NEWLINE# playfield = device2 . machine . ball_devices [ 'playfield' ] #NEWLINE# coil2 . pulse = MagicMock ( ) #NEWLINE# self . _missing = 0 #NEWLINE# self . _captured = 0 #NEWLINE# self . _enter = 0 #NEWLINE# self . machine . events . add_handler ( 'balldevice_test_launcher_ball_request' , self . _requesting_ball ) #NEWLINE# self . machine . events . add_handler ( 'balldevice_1_ball_missing' , self . _missing_ball ) #NEWLINE# self . machine . events . add_handler ( 'balldevice_captured_from_playfield' , self . _captured_from_pf ) #NEWLINE# self . machine . events . add_handler ( 'balldevice_test_target1_ball_enter' , self . _ball_enter ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_launcher' , 1 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# coil2 . pulse . assert_called_once_with ( ) #NEWLINE# self . assertEquals ( 1 , self . _captured ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_launcher' , 0 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . advance_time_and_run ( 15 ) #NEWLINE# coil2 . pulse . assert_called_once_with ( ) #NEWLINE# self . advance_time_and_run ( 30 ) #NEWLINE# self . assertEquals ( 0 , self . _requesting ) #NEWLINE# self . assertEquals ( 1 , self . _missing ) #NEWLINE# self . assertEquals ( 1 , playfield . balls ) #NEWLINE# self . _missing = 0 #NEWLINE# self . _requesting = 0 #NEWLINE# self . _captured = 0 #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_target1' , 1 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 1 , self . _captured ) #NEWLINE# self . assertEquals ( 0 , self . _missing ) #NEWLINE# self . assertEquals ( 0 , playfield . balls ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_target1' , 0 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_playfield' , 1 ) #NEWLINE# self . advance_time_and_run ( 0.1 ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_playfield' , 0 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 1 , playfield . balls ) #NEWLINE# self . _captured = 0 #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_launcher' , 1 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 2 , coil2 . pulse . call_count ) #NEWLINE# self . assertEquals ( 1 , self . _captured ) #NEWLINE# self . assertEquals ( 0 , self . _missing ) #NEWLINE# self . assertEquals ( 0 , playfield . balls ) #NEWLINE# self . _captured = 0 #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_launcher' , 0 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_target1' , 1 ) #NEWLINE# self . assertEquals ( 0 , self . _captured ) #NEWLINE# self . assertEquals ( 0 , self . _missing ) #NEWLINE# self . assertEquals ( 0 , playfield . balls )