<s> from MpfTestCase import MpfTestCase <EOL> from mock import MagicMock <EOL> class TestTutorialStep15 ( MpfTestCase ) : <EOL> def getConfigFile ( self ) : <EOL> return '<STR_LIT>' <EOL> def getMachinePath ( self ) : <EOL> return '<STR_LIT>' <EOL> def get_platform ( self ) : <EOL> return '<STR_LIT>' <EOL> def test_game ( self ) : <EOL> self . machine . ball_controller . num_balls_known = <NUM_LIT:5> <EOL> self . assertEqual ( <NUM_LIT:5> , self . machine . ball_devices . bd_trough . balls ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . advance_time_and_run ( <NUM_LIT:2> ) <EOL> self . assertEqual ( <NUM_LIT:1> , self . machine . ball_devices . bd_plunger . balls ) <EOL> self . assertEqual ( <NUM_LIT:4> , self . machine . ball_devices . bd_trough . balls ) <EOL> self . assertEqual ( <NUM_LIT:0> , self . machine . ball_devices . playfield . balls ) <EOL> self . assertTrue ( self . machine . mode_controller . is_active ( '<STR_LIT>' ) ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . advance_time_and_run ( <NUM_LIT:2> ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . advance_time_and_run ( <NUM_LIT:2> ) <EOL> self . assertEqual ( <NUM_LIT:1> , self . machine . game . player . ball ) <EOL> self . assertEqual ( <NUM_LIT:0> , self . machine . ball_devices . bd_plunger . balls ) <EOL> self . assertEqual ( <NUM_LIT:4> , self . machine . ball_devices . bd_trough . balls ) <EOL> self . assertEqual ( <NUM_LIT:1> , self . machine . ball_devices . playfield . balls ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . advance_time_and_run ( <NUM_LIT:2> ) <EOL> self . advance_time_and_run ( <NUM_LIT:1> ) <EOL> self . assertEqual ( <NUM_LIT:1> , self . machine . ball_devices . playfield . balls ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . advance_time_and_run ( <NUM_LIT:3> ) <EOL> self . assertEqual ( <NUM_LIT:1> , self . machine . ball_devices . playfield . balls ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . advance_time_and_run ( <NUM_LIT:3> ) <EOL> self . assertEqual ( <NUM_LIT:1> , self . machine . ball_devices . playfield . balls ) <EOL> self . machine . default_platform . add_ball_to_device ( <EOL> self . machine . ball_devices . bd_trough ) <EOL> self . advance_time_and_run ( <NUM_LIT:1> ) <EOL> self . advance_time_and_run ( <NUM_LIT:1> ) <EOL> self . assertEqual ( <NUM_LIT:2> , self . machine . game . player . ball ) <EOL> self . assertEqual ( <NUM_LIT:1> , self . machine . ball_devices . bd_plunger . balls ) <EOL> self . assertEqual ( <NUM_LIT:4> , self . machine . ball_devices . bd_trough . balls ) <EOL> self . assertEqual ( <NUM_LIT:0> , self . machine . ball_devices . playfield . balls ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . advance_time_and_run ( <NUM_LIT:2> ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . advance_time_and_run ( <NUM_LIT:2> ) <EOL> self . assertEqual ( <NUM_LIT:2> , self . machine . game . player . ball ) <EOL> self . assertEqual ( <NUM_LIT:0> , self . machine . ball_devices . bd_plunger . balls ) <EOL> self . assertEqual ( <NUM_LIT:4> , self . machine . ball_devices . bd_trough . balls ) <EOL> self . assertEqual ( <NUM_LIT:1> , self . machine . ball_devices . playfield . balls ) <EOL> self . machine . default_platform . add_ball_to_device ( <EOL> self . machine . ball_devices . bd_trough ) <EOL> self . advance_time_and_run ( <NUM_LIT:1> ) <EOL> self . advance_time_and_run ( <NUM_LIT:1> ) <EOL> self . assertEqual ( <NUM_LIT:3> , self . machine . game . player . ball ) <EOL> self . assertEqual ( <NUM_LIT:1> , self . machine . ball_devices . bd_plunger . balls ) <EOL> self . assertEqual ( <NUM_LIT:4> , self . machine . ball_devices . bd_trough . balls ) <EOL> self . assertEqual ( <NUM_LIT:0> , self . machine . ball_devices . playfield . balls ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . machine . switch_controller . process_switch ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . advance_time_and_run ( <NUM_LIT:2> ) <EOL> self . advance_time_and_run ( <NUM_LIT:2> ) <EOL> self . assertEqual ( <NUM_LIT:3> , self . machine . game . player . ball ) <EOL> self . assertEqual ( <NUM_LIT:0> , self . machine . ball_devices . bd_plunger . balls ) <EOL> self . assertEqual ( <NUM_LIT:4> , self . machine . ball_devices . bd_trough . balls ) <EOL> self . assertEqual ( <NUM_LIT:1> , self . machine . ball_devices . playfield . balls ) <EOL> self . machine . default_platform . add_ball_to_device ( <EOL> self . machine . ball_devices . bd_trough ) <EOL> self . advance_time_and_run ( <NUM_LIT:1> ) <EOL> self . advance_time_and_run ( <NUM_LIT:1> ) <EOL> self . assertIsNone ( self . machine . game ) <EOL> self . assertEqual ( <NUM_LIT:0> , self . machine . ball_devices . bd_plunger . balls ) <EOL> self . assertEqual ( <NUM_LIT:5> , self . machine . ball_devices . bd_trough . balls ) <EOL> self . assertEqual ( <NUM_LIT:0> , self . machine . ball_devices . playfield . balls ) <EOL> self . assertFalse ( self . machine . mode_controller . is_active ( '<STR_LIT>' ) ) </s>
