#NEWLINE# def test_missing_ball_idle( self ) : #NEWLINE# #INDENT# coil1 = self . machine . coils [ 'eject_coil1' ] #NEWLINE# device1 = self . machine . ball_devices [ 'test_trough' ] #NEWLINE# playfield = self . machine . ball_devices [ 'playfield' ] #NEWLINE# self . machine . events . add_handler ( 'balldevice_captured_from_playfield' , self . _captured_from_pf ) #NEWLINE# self . machine . events . add_handler ( 'balldevice_1_ball_missing' , self . _missing_ball ) #NEWLINE# self . _captured = 0 #NEWLINE# self . _missing = 0 #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch1' , 1 ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch2' , 1 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 2 , self . _captured ) #NEWLINE# self . _captured = 0 #NEWLINE# self . assertEquals ( 0 , playfield . balls ) #NEWLINE# coil1 . pulse = MagicMock ( ) #NEWLINE# self . assertEquals ( 2 , device1 . balls ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch1' , 0 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# assert ( not coil1 . pulse . called ) #NEWLINE# self . assertEquals ( 1 , self . _missing ) #NEWLINE# self . assertEquals ( 0 , self . _captured ) #NEWLINE# self . assertEquals ( 1 , playfield . balls ) #NEWLINE# self . assertEquals ( 1 , device1 . balls ) #NEWLINE# playfield . add_ball ( ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# coil1 . pulse . assert_called_once_with ( ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch2' , 0 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 0 , device1 . balls ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch1' , 1 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_launcher' , 1 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 1 , device1 . balls ) #NEWLINE# self . assertEquals ( 0 , playfield . balls ) #NEWLINE# self . assertEquals ( 1 , self . _missing ) #NEWLINE# self . assertEquals ( 1 , self . _captured )