Skip to content

Commit

Permalink
tests: Update structural_tests to pass with pycodestyle 2.9 and 2.11
Browse files Browse the repository at this point in the history
pycodestyle 2.11 no longer reports E741 - ambiguous variable name for
`if l == True` because it doesn't contain an assignment.

PyCQA/pycodestyle#1118
  • Loading branch information
bkeryan committed Oct 5, 2023
1 parent 2d0e97e commit 366f320
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ def return_no_cheese_found(self):
except:
pass

l = 5
i = 3
j = 5

if l == True:
return False
l = (i == True)

return cheese_found
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ class Cheese_Shop: # noqa: D101, N801 - Missing docstring in public class (auto
except: # noqa: E722 - do not use bare 'except' (auto-generated noqa)
pass

l = 5 # noqa: E741 - ambiguous variable name 'l' (auto-generated noqa)
i = 3 # noqa: F841 - local variable 'i' is assigned to but never used (auto-generated noqa)
i = 3
j = 5 # noqa: F841 - local variable 'j' is assigned to but never used (auto-generated noqa)

if l == True: # noqa: E741, E712 - ambiguous variable name 'l' (auto-generated noqa), comparison to True should be 'if cond is True:' or 'if cond:' (auto-generated noqa)
return False
l = (i == True) # noqa: E712, E741, F841 - comparison to True should be 'if cond is True:' or 'if cond:' (auto-generated noqa), ambiguous variable name 'l' (auto-generated noqa), local variable 'l' is assigned to but never used (auto-generated noqa)

return cheese_found
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,12 @@ def return_no_cheese_found(self):
except: # noqa: E722 - do not use bare 'except' (auto-generated noqa)
pass

l = 5 # noqa: E741 - ambiguous variable name 'l' (auto-generated noqa)
i = 3 # noqa: F841 - local variable 'i' is assigned to but never used (auto-generated noqa)
i = 3
j = 5 # noqa: F841 - local variable 'j' is assigned to but never used (auto-generated noqa)

if (
l
l = ( # noqa: E741, F841 - ambiguous variable name 'l' (auto-generated noqa), local variable 'l' is assigned to but never used (auto-generated noqa)
i
== True # noqa: E712 - comparison to True should be 'if cond is True:' or 'if cond:' (auto-generated noqa)
):
return False
)

return cheese_found

0 comments on commit 366f320

Please sign in to comment.