#NEWLINE# def test_eject_successful_to_playfield( self ) : #NEWLINE# #INDENT# coil1 = self . machine . coils [ 'eject_coil1' ] #NEWLINE# coil2 = self . machine . coils [ 'eject_coil2' ] #NEWLINE# coil3 = self . machine . coils [ 'eject_coil3' ] #NEWLINE# coil4 = self . machine . coils [ 'eject_coil4' ] #NEWLINE# coil_diverter = self . machine . coils [ 'c_diverter' ] #NEWLINE# device1 = self . machine . ball_devices [ 'test_trough' ] #NEWLINE# device2 = self . machine . ball_devices [ 'test_launcher' ] #NEWLINE# device3 = self . machine . ball_devices [ 'test_target1' ] #NEWLINE# device4 = self . machine . ball_devices [ 'test_target2' ] #NEWLINE# playfield = self . machine . ball_devices [ 'playfield' ] #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch1' , 1 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 0 , playfield . balls ) #NEWLINE# coil1 . pulse = MagicMock ( ) #NEWLINE# coil2 . pulse = MagicMock ( ) #NEWLINE# coil3 . pulse = MagicMock ( ) #NEWLINE# coil4 . pulse = MagicMock ( ) #NEWLINE# self . assertEquals ( 1 , device1 . balls ) #NEWLINE# assert ( not coil1 . pulse . called ) #NEWLINE# assert ( not coil2 . pulse . called ) #NEWLINE# assert ( not coil3 . pulse . called ) #NEWLINE# assert ( not coil4 . pulse . called ) #NEWLINE# playfield . add_ball ( ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# coil1 . pulse . assert_called_once_with ( ) #NEWLINE# assert ( not coil2 . pulse . called ) #NEWLINE# assert ( not coil3 . pulse . called ) #NEWLINE# assert ( not coil4 . pulse . called ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch1' , 0 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 0 , device1 . balls ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_launcher' , 1 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 1 , device2 . balls ) #NEWLINE# coil1 . pulse . assert_called_once_with ( ) #NEWLINE# coil2 . pulse . assert_called_once_with ( ) #NEWLINE# assert ( not coil3 . pulse . called ) #NEWLINE# assert ( not coil4 . pulse . called ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_launcher' , 0 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 0 , device2 . balls ) #NEWLINE# coil_diverter . enable = MagicMock ( ) #NEWLINE# coil_diverter . disable = MagicMock ( ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_diverter' , 1 ) #NEWLINE# self . advance_time_and_run ( 0.01 ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_diverter' , 0 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# assert ( not coil_diverter . enable . called ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_target1' , 1 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 1 , device3 . balls ) #NEWLINE# coil1 . pulse . assert_called_once_with ( ) #NEWLINE# coil2 . pulse . assert_called_once_with ( ) #NEWLINE# coil3 . pulse . assert_called_once_with ( ) #NEWLINE# assert ( not coil4 . pulse . called ) #NEWLINE# self . machine . switch_controller . process_switch ( 's_ball_switch_target1' , 0 ) #NEWLINE# self . advance_time_and_run ( 1 ) #NEWLINE# self . assertEquals ( 0 , device3 . balls ) #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 )