diff --git a/game/end_to_end_tests/base_game_test.py b/game/end_to_end_tests/base_game_test.py index c472c40f4..68bce316b 100644 --- a/game/end_to_end_tests/base_game_test.py +++ b/game/end_to_end_tests/base_game_test.py @@ -45,11 +45,7 @@ def _go_to_path(self, path): def _complete_level(self, level_number, from_python_den=False, **kwargs): page = self.go_to_level(level_number, from_python_den) - ( - self.complete_and_check_level( - level_number, page, from_python_den, **kwargs - ) - ) + (self.complete_and_check_level(level_number, page, from_python_den, **kwargs)) def complete_and_check_level( self, @@ -95,9 +91,7 @@ def go_to_homepage(self): def go_to_level(self, level_name, from_python_den=False): viewname = ( - "play_python_default_level" - if from_python_den - else "play_default_level" + "play_python_default_level" if from_python_den else "play_default_level" ) path = reverse(viewname, kwargs={"level_name": str(level_name)}) @@ -107,9 +101,7 @@ def go_to_level(self, level_name, from_python_den=False): def go_to_level_without_dismissing_dialog(self, level_name, from_python_den=False): viewname = ( - "play_python_default_level" - if from_python_den - else "play_default_level" + "play_python_default_level" if from_python_den else "play_default_level" ) path = reverse(viewname, kwargs={"level_name": str(level_name)}) @@ -130,13 +122,9 @@ def go_to_level_editor(self): def go_to_episode(self, episodeId): if int(episodeId) > 9: - path = reverse( - "start_python_episode", kwargs={"episodeId": str(episodeId)} - ) + path = reverse("start_python_episode", kwargs={"episodeId": str(episodeId)}) else: - path = reverse( - "start_episode", kwargs={"episodeId": str(episodeId)} - ) + path = reverse("start_episode", kwargs={"episodeId": str(episodeId)}) self._go_to_path(path) return GamePage(self.selenium) @@ -151,11 +139,7 @@ def try_again_if_not_full_score_test(self, level, workspace_file): workspace_id = self.use_workspace(workspace_file, user_profile) - return ( - self.go_to_level(level) - .load_solution(workspace_id) - .run_retry_program() - ) + return self.go_to_level(level).load_solution(workspace_id).run_retry_program() def run_crashing_test(self, level, workspace_file): user_profile = self.login_once() @@ -163,9 +147,7 @@ def run_crashing_test(self, level, workspace_file): workspace_id = self.use_workspace(workspace_file, user_profile) return ( - self.go_to_level(level) - .load_solution(workspace_id) - .run_crashing_program() + self.go_to_level(level).load_solution(workspace_id).run_crashing_program() ) def run_animal_sound_horn_test(self, level): @@ -242,9 +224,7 @@ def login_once(self): login_page = self.go_to_homepage().go_to_teacher_login_page() login_page.login(email, password) email = email - BaseGameTest.user_profile = UserProfile.objects.get( - user__email=email - ) + BaseGameTest.user_profile = UserProfile.objects.get(user__email=email) BaseGameTest.already_logged_on = True @@ -261,9 +241,7 @@ def tearDownClass(cls): BaseGameTest.already_logged_on = False def solution_file_path(self, filename): - return os.path.join( - BaseGameTest.BLOCKLY_SOLUTIONS_DIR, filename + ".xml" - ) + return os.path.join(BaseGameTest.BLOCKLY_SOLUTIONS_DIR, filename + ".xml") def read_solution(self, filename): path = self.solution_file_path(filename) diff --git a/game/end_to_end_tests/test_play_through.py b/game/end_to_end_tests/test_play_through.py index b7b297337..1581c6e7b 100644 --- a/game/end_to_end_tests/test_play_through.py +++ b/game/end_to_end_tests/test_play_through.py @@ -11,15 +11,11 @@ def _complete_episode( self, episode_number, level_number, from_python_den=False, **kwargs ): page = self.go_to_episode(episode_number) - self.complete_and_check_level( - level_number, page, from_python_den, **kwargs - ) + self.complete_and_check_level(level_number, page, from_python_den, **kwargs) def _complete_level(self, level_number, from_python_den=False, **kwargs): page = self.go_to_level(level_number, from_python_den) - self.complete_and_check_level( - level_number, page, from_python_den, **kwargs - ) + self.complete_and_check_level(level_number, page, from_python_den, **kwargs) def test_episode_01(self): self._complete_episode(1, 1, check_algorithm_score=False) @@ -286,9 +282,7 @@ def test_level_079(self): self._complete_level(79, final_level=True) def test_episode_12(self): - self._complete_episode( - 12, 1, check_algorithm_score=False, from_python_den=True - ) + self._complete_episode(12, 1, check_algorithm_score=False, from_python_den=True) def test_python_level_001(self): self._complete_level(1, from_python_den=True) @@ -300,19 +294,13 @@ def test_python_level_003(self): self._complete_level(3, from_python_den=True) def test_python_level_004(self): - self._complete_level( - 4, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(4, check_algorithm_score=False, from_python_den=True) def test_python_level_005(self): - self._complete_level( - 5, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(5, check_algorithm_score=False, from_python_den=True) def test_python_level_006(self): - self._complete_level( - 6, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(6, check_algorithm_score=False, from_python_den=True) def test_python_level_007(self): self._complete_level(7, from_python_den=True) @@ -324,24 +312,16 @@ def test_python_level_009(self): self._complete_level(9, from_python_den=True) def test_python_level_010(self): - self._complete_level( - 10, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(10, check_algorithm_score=False, from_python_den=True) def test_python_level_011(self): - self._complete_level( - 11, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(11, check_algorithm_score=False, from_python_den=True) def test_python_level_012(self): - self._complete_level( - 12, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(12, check_algorithm_score=False, from_python_den=True) def test_python_level_013(self): - self._complete_level( - 13, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(13, check_algorithm_score=False, from_python_den=True) def test_episode_14(self): self._complete_episode(14, 14, from_python_den=True) @@ -353,32 +333,22 @@ def test_python_level_015(self): self._complete_level(15, from_python_den=True) def test_python_level_016(self): - self._complete_level( - 16, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(16, check_algorithm_score=False, from_python_den=True) def test_python_level_017(self): - self._complete_level( - 17, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(17, check_algorithm_score=False, from_python_den=True) def test_python_level_018(self): - self._complete_level( - 18, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(18, check_algorithm_score=False, from_python_den=True) def test_python_level_019(self): self._complete_level(19, from_python_den=True) def test_python_level_020(self): - self._complete_level( - 20, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(20, check_algorithm_score=False, from_python_den=True) def test_python_level_021(self): - self._complete_level( - 21, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(21, check_algorithm_score=False, from_python_den=True) def test_python_level_022(self): self._complete_level(22, from_python_den=True) @@ -387,14 +357,10 @@ def test_python_level_023(self): self._complete_level(23, from_python_den=True) def test_python_level_024(self): - self._complete_level( - 24, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(24, check_algorithm_score=False, from_python_den=True) def test_python_level_025(self): - self._complete_level( - 25, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(25, check_algorithm_score=False, from_python_den=True) def test_episode_13(self): self._complete_episode(13, 26, from_python_den=True) @@ -412,9 +378,7 @@ def test_python_level_029(self): self._complete_level(29, from_python_den=True) def test_python_level_030(self): - self._complete_level( - 30, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(30, check_algorithm_score=False, from_python_den=True) def test_python_level_031(self): self._complete_level(31, from_python_den=True) @@ -423,14 +387,10 @@ def test_python_level_032(self): self._complete_level(32, from_python_den=True) def test_python_level_033(self): - self._complete_level( - 33, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(33, check_algorithm_score=False, from_python_den=True) def test_python_level_034(self): - self._complete_level( - 34, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(34, check_algorithm_score=False, from_python_den=True) def test_python_level_035(self): self._complete_level(35, from_python_den=True) @@ -439,25 +399,17 @@ def test_python_level_036(self): self._complete_level(36, from_python_den=True) def test_python_level_037(self): - self._complete_level( - 37, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(37, check_algorithm_score=False, from_python_den=True) @pytest.mark.skip(reason="this level's solution is currently flawed") def test_python_level_038(self): - self._complete_level( - 38, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(38, check_algorithm_score=False, from_python_den=True) def test_python_level_039(self): - self._complete_level( - 39, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(39, check_algorithm_score=False, from_python_den=True) def test_python_level_040(self): - self._complete_level( - 40, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(40, check_algorithm_score=False, from_python_den=True) def test_python_level_041(self): self._complete_level(41, from_python_den=True, redirects=True) @@ -468,42 +420,28 @@ def test_episode_15(self): ) def test_python_level_042(self): - self._complete_level( - 42, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(42, check_algorithm_score=False, from_python_den=True) def test_python_level_043(self): - self._complete_level( - 43, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(43, check_algorithm_score=False, from_python_den=True) def test_python_level_044(self): self._complete_level(44, from_python_den=True) def test_python_level_045(self): - self._complete_level( - 45, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(45, check_algorithm_score=False, from_python_den=True) def test_python_level_046(self): - self._complete_level( - 46, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(46, check_algorithm_score=False, from_python_den=True) def test_python_level_047(self): - self._complete_level( - 47, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(47, check_algorithm_score=False, from_python_den=True) def test_python_level_048(self): - self._complete_level( - 48, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(48, check_algorithm_score=False, from_python_den=True) def test_python_level_049(self): - self._complete_level( - 49, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(49, check_algorithm_score=False, from_python_den=True) def test_episode_22(self): self._complete_episode(22, 50, from_python_den=True) @@ -515,44 +453,28 @@ def test_python_level_051(self): self._complete_level(51, from_python_den=True) def test_python_level_052(self): - self._complete_level( - 52, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(52, check_algorithm_score=False, from_python_den=True) def test_python_level_053(self): - self._complete_level( - 53, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(53, check_algorithm_score=False, from_python_den=True) def test_python_level_054(self): - self._complete_level( - 54, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(54, check_algorithm_score=False, from_python_den=True) def test_python_level_055(self): - self._complete_level( - 55, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(55, check_algorithm_score=False, from_python_den=True) def test_python_level_056(self): - self._complete_level( - 56, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(56, check_algorithm_score=False, from_python_den=True) def test_python_level_057(self): - self._complete_level( - 57, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(57, check_algorithm_score=False, from_python_den=True) def test_python_level_058(self): - self._complete_level( - 58, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(58, check_algorithm_score=False, from_python_den=True) def test_python_level_059(self): - self._complete_level( - 59, check_algorithm_score=False, from_python_den=True - ) + self._complete_level(59, check_algorithm_score=False, from_python_den=True) def test_python_level_060(self): self._complete_level(