BOM-2494: pyupgrade second iteration-IX (#27449)

This commit is contained in:
Usama Sadiq
2021-05-10 13:45:29 +05:00
committed by GitHub
parent 35d7b13de3
commit e7b8328620
11 changed files with 16 additions and 16 deletions

View File

@@ -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()

View File

@@ -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):

View File

@@ -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):

View File

@@ -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'

View File

@@ -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):
"""

View File

@@ -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()

View File

@@ -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,

View File

@@ -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

View File

@@ -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 = {}

View File

@@ -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."

View File

@@ -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