1
0
Fork 0
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:
deepsource-autofix[bot] 2023-05-22 22:04:59 +00:00 committed by GitHub
parent cdc9b51165
commit a9e9acd211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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