Best Python code snippet using localstack_python
test_multistage_stages.py
Source:test_multistage_stages.py
...21 return multistage_fitter.fit('ntds')22 def test_multistage_fit_with_1_stage_has_only_1_stage(self):23 self.assertEqual(1, TestMultistageStages.full_go_fit.get_number_of_stages())24 def test_full_go_stage_1_begins_at_t_equal_0(self):25 stages = TestMultistageStages.full_go_fit.get_stages()26 stage_1 = stages[0]27 self.assertEqual(0, stage_1.get_initial_t())28 def test_full_go_stage_1_ends_at_t_equal_250(self):29 stages = TestMultistageStages.full_go_fit.get_stages()30 stage_1 = stages[0]31 self.assertEqual(250, stage_1.get_end_t())32 def test_multistage_fit_with_2_stages_has_2_stages(self):33 self.assertEqual(2, TestMultistageStages.ds_go_fit.get_number_of_stages())34 def test_ds_go_stage_1_begins_at_t_equal_0(self):35 stages = TestMultistageStages.ds_go_fit.get_stages()36 stage_1 = stages[0]37 self.assertEqual(0, stage_1.get_initial_t())38 def test_ds_go_stage_1_ends_at_t_equal_87(self):39 stages = TestMultistageStages.ds_go_fit.get_stages()40 stage_1 = stages[0]41 self.assertEqual(87, stage_1.get_end_t())42 def test_ds_go_stage_2_begins_at_t_equal_87(self):43 stages = TestMultistageStages.ds_go_fit.get_stages()44 stage_2 = stages[1]45 self.assertEqual(87, stage_2.get_initial_t())46 def test_ds_go_stage_2_ends_at_t_equal_250(self):47 stages = TestMultistageStages.ds_go_fit.get_stages()48 stage_2 = stages[1]49 self.assertEqual(250, stage_2.get_end_t())50 def test_ds_go_stage_2_begins_at_the_same_t_where_stage_1_ends(self):51 stages = TestMultistageStages.ds_go_fit.get_stages()52 stage_1 = stages[0]53 stage_2 = stages[1]54 self.assertEqual(stage_1.get_end_t(), stage_2.get_initial_t())55 def test_defining_a_stage_with_initial_time_different_than_previous_stage_end_time_should_raise_exception(self):56 with self.assertRaises(InvalidStageDefinitionException) as error:57 multistage_fitter = MultistageFitter()58 multistage_fitter.add_stage(0, 87, 'delayed-s-shaped')59 multistage_fitter.add_stage(90, 250, 'goel-okumoto')60 self.assertEqual(error.exception.strerror, 'The added stage must begin at the same t where the previous stage '...
StoryModeScreen.py
Source:StoryModeScreen.py
...15 #Put a video for the StoryMode:16 self.create_videos()17 #Draw the back button18 self.back = self.write(self.end_font, WHITE, "Back", self.screen_width // 2, self.screen_height / 1.2)19 def get_stages(self) -> int:20 """Get the total number of stages in the story mode"""21 return self.stages22 def create_videos(self) -> None:23 """Create videos buttons for the videos"""24 #Iterate through all the stage videos25 for i in range(1,self.get_stages()//2+1):26 #Append the button to the buttons list for checking later27 self.video_buttons.append(self.write(self.end_font, WHITE, f"Stage {i} ", self.screen_width // 2, self.screen_height // 2 + (40*i) - 30, Direction.RIGHT))28 for i in range(1, self.get_stages() - self.get_stages()//2 + 1):29 #Append the button to the buttons list for checking later30 self.video_buttons.append(self.write(self.end_font, WHITE, f" Stage {self.get_stages()//2 + i}", self.screen_width // 2, self.screen_height // 2 + (40*i - self.get_stages() // 2 + 1) - 30, Direction.LEFT))31 def check_mousepress(self) -> State:32 """Check the mouse press of the user"""33 #Check if the user clicked the back button34 if self.check_clicked(self.back):35 #Return menu state36 return State.ONE_PLAYER_MENU37 #Loop through the the video buttons38 for index,rect in enumerate(self.video_buttons):39 if self.check_clicked(rect):40 return State(100 + index)41 return self.state42 def handle(self) -> None:43 """Handle the drawing of the screen"""44 #Call the superclass update...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!