mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-29 08:56:23 -07:00
refactor: replace range(len(...)) with enumerate(...)
Using `range(len(...))` is not pythonic. Python does not have not index-based loops. Instead, it uses collection iterators. Python has a built-in method `enumerate` which adds a counter to an iterable.
This commit is contained in:
parent
cdc9b51165
commit
a9e9acd211
1 changed files with 2 additions and 2 deletions
|
@ -20,8 +20,8 @@ class TestManageActions(SeleniumTestCase):
|
|||
trs = self.driver.find_elements(by=By.CSS_SELECTOR, value="#content table tr")
|
||||
for tr in trs:
|
||||
tds = tr.find_elements(by=By.TAG_NAME, value="td")
|
||||
for c in range(len(tds)):
|
||||
if tds[c].text == msg_text:
|
||||
for c, item in enumerate(tds):
|
||||
if item.text == msg_text:
|
||||
# found the post we made
|
||||
link = tds[c-2].find_element(by=By.LINK_TEXT, value="Post")
|
||||
return link
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue