Skip to content

Commit

Permalink
Remove detection of strings in B018 (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasium authored Nov 29, 2021
1 parent 9e311d5 commit 225f4e6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion bugbear.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,6 @@ def check_for_b018(self, node):
if isinstance(
subnode.value,
(
ast.Str,
ast.Num,
ast.Bytes,
ast.NameConstant,
Expand Down
3 changes: 2 additions & 1 deletion tests/b018_classes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Should emit:
B018 - on lines 15-26, 30, 32
B018 - on lines 16-26, 30, 33
"""


Expand Down Expand Up @@ -30,3 +30,4 @@ class Foo3:
123
a = 2
"str"
1
3 changes: 2 additions & 1 deletion tests/b018_functions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Should emit:
B018 - on lines 14-25, 29, 31
B018 - on lines 15-25, 29, 32
"""


Expand Down Expand Up @@ -29,3 +29,4 @@ def foo3():
123
a = 2
"str"
3
8 changes: 4 additions & 4 deletions tests/test_bugbear.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,19 +234,19 @@ def test_b018_functions(self):
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())

expected = [B018(line, 4) for line in range(14, 26)]
expected = [B018(line, 4) for line in range(15, 26)]
expected.append(B018(29, 4))
expected.append(B018(31, 4))
expected.append(B018(32, 4))
self.assertEqual(errors, self.errors(*expected))

def test_b018_classes(self):
filename = Path(__file__).absolute().parent / "b018_classes.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())

expected = [B018(line, 4) for line in range(15, 27)]
expected = [B018(line, 4) for line in range(16, 27)]
expected.append(B018(30, 4))
expected.append(B018(32, 4))
expected.append(B018(33, 4))
self.assertEqual(errors, self.errors(*expected))

def test_b901(self):
Expand Down

0 comments on commit 225f4e6

Please sign in to comment.