Skip to content

Commit

Permalink
Add regression tests for issue pylint-dev#3711
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Jul 31, 2021
1 parent a31e6bc commit 9588ad2
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/functional/u/undefined/undefined_loop_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,33 @@ def range(key):
for var in range(3):
pass
return var # [undefined-loop-variable]


def test(content):
# https://github.com/PyCQA/pylint/issues/3711
def handle_line(layne):
if "X" in layne:
layne = layne.replace("X", "Y")
elif "Y" in layne: # line 5
layne = '{}'.format(layne)
elif "Z" in layne: # line 7
layne = f'{layne}'
else:
layne = '%s' % layne # line 10

for layne in content.split('\n'):
handle_line(layne)


lst = []
lst2 = [1, 2, 3]

for item in lst:
pass

bigger = [
[
x for x in lst2 if x > item
]
for item in lst
]

0 comments on commit 9588ad2

Please sign in to comment.