From e7b83286201813c6e9d82d4ddcd7401e66cf30b3 Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Mon, 10 May 2021 13:45:29 +0500 Subject: [PATCH] BOM-2494: pyupgrade second iteration-IX (#27449) --- common/test/acceptance/pages/lms/courseware.py | 2 +- common/test/acceptance/pages/lms/fields.py | 2 +- common/test/acceptance/pages/lms/tab_nav.py | 4 ++-- common/test/acceptance/pages/lms/video/video.py | 2 +- common/test/acceptance/pages/studio/library.py | 2 +- common/test/acceptance/pages/studio/video/video.py | 4 ++-- common/test/acceptance/tests/lms/test_account_settings.py | 2 +- common/test/acceptance/tests/lms/test_learner_profile.py | 2 +- common/test/acceptance/tests/lms/test_lms_dashboard.py | 2 +- common/test/acceptance/tests/lms/test_lms_problems.py | 2 +- common/test/acceptance/tests/lms/test_progress_page.py | 8 ++++---- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/common/test/acceptance/pages/lms/courseware.py b/common/test/acceptance/pages/lms/courseware.py index e9a2b82730..d54bfcabd8 100644 --- a/common/test/acceptance/pages/lms/courseware.py +++ b/common/test/acceptance/pages/lms/courseware.py @@ -45,7 +45,7 @@ class CoursewarePage(CoursePage): except IndexError: return False - sequential_position_css = '#sequence-list #tab_{}'.format(sequential_position - 1) + sequential_position_css = f'#sequence-list #tab_{sequential_position - 1}' self.q(css=sequential_position_css).first.click() EmptyPromise(is_at_new_position, "Position navigation fulfilled").fulfill() diff --git a/common/test/acceptance/pages/lms/fields.py b/common/test/acceptance/pages/lms/fields.py index ea562c8303..c8a3066295 100644 --- a/common/test/acceptance/pages/lms/fields.py +++ b/common/test/acceptance/pages/lms/fields.py @@ -114,7 +114,7 @@ class FieldsMixin: """ EmptyPromise( lambda: indicator == self.indicator_for_field(field_id), - "Indicator \"{}\" is visible.".format(self.indicator_for_field(field_id)) + f"Indicator \"{self.indicator_for_field(field_id)}\" is visible." ).fulfill() def make_field_editable(self, field_id): diff --git a/common/test/acceptance/pages/lms/tab_nav.py b/common/test/acceptance/pages/lms/tab_nav.py index 54c4e92c1e..325415fa02 100644 --- a/common/test/acceptance/pages/lms/tab_nav.py +++ b/common/test/acceptance/pages/lms/tab_nav.py @@ -57,9 +57,9 @@ class TabNavPage(PageObject): return None else: if self.is_using_boostrap_style_tabs(): - return 'ul.navbar-nav li:nth-of-type({}) a'.format(tab_index + 1) + return f'ul.navbar-nav li:nth-of-type({tab_index + 1}) a' else: - return 'ol.course-tabs li:nth-of-type({}) a'.format(tab_index + 1) + return f'ol.course-tabs li:nth-of-type({tab_index + 1}) a' @property def tab_names(self): diff --git a/common/test/acceptance/pages/lms/video/video.py b/common/test/acceptance/pages/lms/video/video.py index 5813107db2..b28bf750b5 100644 --- a/common/test/acceptance/pages/lms/video/video.py +++ b/common/test/acceptance/pages/lms/video/video.py @@ -137,7 +137,7 @@ class VideoPage(PageObject): video_display_names = self.q(css=CSS_CLASS_NAMES['video_display_name']).text if video_display_name not in video_display_names: raise ValueError(f"Incorrect Video Display Name: '{video_display_name}'") - return '.vert.vert-{}'.format(video_display_names.index(video_display_name)) + return f'.vert.vert-{video_display_names.index(video_display_name)}' else: return '.vert.vert-0' diff --git a/common/test/acceptance/pages/studio/library.py b/common/test/acceptance/pages/studio/library.py index fd168fb104..cd1e706225 100644 --- a/common/test/acceptance/pages/studio/library.py +++ b/common/test/acceptance/pages/studio/library.py @@ -23,7 +23,7 @@ class LibraryPage(PageObject, HelpMixin): """ URL to the library edit page for the given library. """ - return "{}/library/{}".format(BASE_URL, str(self.locator)) + return f"{BASE_URL}/library/{str(self.locator)}" def is_browser_on_page(self): """ diff --git a/common/test/acceptance/pages/studio/video/video.py b/common/test/acceptance/pages/studio/video/video.py index 2cfd69ffac..68f2f85068 100644 --- a/common/test/acceptance/pages/studio/video/video.py +++ b/common/test/acceptance/pages/studio/video/video.py @@ -331,7 +331,7 @@ class VideoComponentPage(VideoPage): line_number (int): caption line number """ - caption_line_selector = ".subtitles li span[data-index='{index}']".format(index=line_number - 1) + caption_line_selector = f".subtitles li span[data-index='{line_number - 1}']" self.q(css=caption_line_selector).results[0].send_keys(Keys.ENTER) def is_caption_line_focused(self, line_number): @@ -342,7 +342,7 @@ class VideoComponentPage(VideoPage): line_number (int): caption line number """ - caption_line_selector = ".subtitles li span[data-index='{index}']".format(index=line_number - 1) + caption_line_selector = f".subtitles li span[data-index='{line_number - 1}']" caption_container = self.q(css=caption_line_selector).results[0].find_element_by_xpath('..') return 'focused' in caption_container.get_attribute('class').split() diff --git a/common/test/acceptance/tests/lms/test_account_settings.py b/common/test/acceptance/tests/lms/test_account_settings.py index 6bc7ff7461..39fbc96ac7 100644 --- a/common/test/acceptance/tests/lms/test_account_settings.py +++ b/common/test/acceptance/tests/lms/test_account_settings.py @@ -36,7 +36,7 @@ class AccountSettingsTestMixin(EventsTestMixin, AcceptanceTest): """ Create a unique user and return the account's username and id. """ - username = "test_{uuid}".format(uuid=self.unique_id[0:6]) + username = f"test_{self.unique_id[0:6]}" auto_auth_page = AutoAuthPage( self.browser, username=username, diff --git a/common/test/acceptance/tests/lms/test_learner_profile.py b/common/test/acceptance/tests/lms/test_learner_profile.py index 7a5e47c19f..b72047b4ac 100644 --- a/common/test/acceptance/tests/lms/test_learner_profile.py +++ b/common/test/acceptance/tests/lms/test_learner_profile.py @@ -30,7 +30,7 @@ class LearnerProfileTestMixin(EventsTestMixin): """ Create a unique user and return the account's username and id. """ - username = "test_{uuid}".format(uuid=self.unique_id[0:6]) + username = f"test_{self.unique_id[0:6]}" auto_auth_page = AutoAuthPage(self.browser, username=username).visit() user_id = auto_auth_page.get_user_id() return username, user_id diff --git a/common/test/acceptance/tests/lms/test_lms_dashboard.py b/common/test/acceptance/tests/lms/test_lms_dashboard.py index b5fe7cb7e7..53d1eafc5c 100644 --- a/common/test/acceptance/tests/lms/test_lms_dashboard.py +++ b/common/test/acceptance/tests/lms/test_lms_dashboard.py @@ -52,7 +52,7 @@ class BaseLmsDashboardTestMultiple(UniqueCourseTest): } } - self.username = "test_{uuid}".format(uuid=self.unique_id[0:6]) + self.username = f"test_{self.unique_id[0:6]}" self.email = f"{self.username}@example.com" self.course_keys = {} diff --git a/common/test/acceptance/tests/lms/test_lms_problems.py b/common/test/acceptance/tests/lms/test_lms_problems.py index c96c7262f5..342db5946c 100644 --- a/common/test/acceptance/tests/lms/test_lms_problems.py +++ b/common/test/acceptance/tests/lms/test_lms_problems.py @@ -21,7 +21,7 @@ class ProblemsTest(UniqueCourseTest): def setUp(self): super().setUp() - self.username = "test_student_{uuid}".format(uuid=self.unique_id[0:8]) + self.username = f"test_student_{self.unique_id[0:8]}" self.email = f"{self.username}@example.com" self.password = "keep it secret; keep it safe." diff --git a/common/test/acceptance/tests/lms/test_progress_page.py b/common/test/acceptance/tests/lms/test_progress_page.py index e84c06f87d..17addcdc8d 100644 --- a/common/test/acceptance/tests/lms/test_progress_page.py +++ b/common/test/acceptance/tests/lms/test_progress_page.py @@ -240,13 +240,13 @@ class SubsectionGradingPolicyA11yTest(SubsectionGradingPolicyBase): for i in range(1, 10): self._check_tick_text( i, - ['Homework {index} Unreleased - 0% (?/?)'.format(index=i + 1)], - 'HW 0{index}'.format(index=i + 1) if i < 9 else 'HW {index}'.format(index=i + 1) + [f'Homework {i + 1} Unreleased - 0% (?/?)'], + f'HW 0{i + 1}' if i < 9 else f'HW {i + 1}' ) self._check_tick_text( i + 13, - ['Lab {index} Unreleased - 0% (?/?)'.format(index=i + 1)], - 'Lab 0{index}'.format(index=i + 1) if i < 9 else 'Lab {index}'.format(index=i + 1) + [f'Lab {i + 1} Unreleased - 0% (?/?)'], + f'Lab 0{i + 1}' if i < 9 else f'Lab {i + 1}' ) # Verify the overall score. The first element in the array is the sr-only text, and the