Skip to content

Commit

Permalink
update unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
r-downing committed Dec 1, 2023
1 parent 6829d60 commit 6fb2eee
Showing 1 changed file with 48 additions and 11 deletions.
59 changes: 48 additions & 11 deletions tests/test_bugbear.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,31 +267,68 @@ def test_b018_functions(self):
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())

expected = [B018(line, 4) for line in range(15, 25)]
expected.append(B018(28, 4))
expected.append(B018(31, 4))
expected.append(B018(32, 4))
expected.append(B018(33, 4))
expected = [
B018(15, 4, vars=("Constant",)),
B018(16, 4, vars=("Constant",)),
B018(17, 4, vars=("Constant",)),
B018(18, 4, vars=("Constant",)),
B018(19, 4, vars=("Constant",)),
B018(20, 4, vars=("Constant",)),
B018(21, 4, vars=("Constant",)),
B018(22, 4, vars=("List",)),
B018(23, 4, vars=("Set",)),
B018(24, 4, vars=("Dict",)),
B018(28, 4, vars=("Constant",)),
B018(31, 4, vars=("Constant",)),
B018(32, 4, vars=("Tuple",)),
B018(33, 4, vars=("Tuple",)),
]

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(16, 26)]
expected.append(B018(29, 4))
expected.append(B018(32, 4))
expected.append(B018(33, 4))
expected.append(B018(34, 4))
expected = [
B018(16, 4, vars=("Constant",)),
B018(17, 4, vars=("Constant",)),
B018(18, 4, vars=("Constant",)),
B018(19, 4, vars=("Constant",)),
B018(20, 4, vars=("Constant",)),
B018(21, 4, vars=("Constant",)),
B018(22, 4, vars=("Constant",)),
B018(23, 4, vars=("List",)),
B018(24, 4, vars=("Set",)),
B018(25, 4, vars=("Dict",)),
B018(29, 4, vars=("Constant",)),
B018(32, 4, vars=("Constant",)),
B018(33, 4, vars=("Tuple",)),
B018(34, 4, vars=("Tuple",)),
]

self.assertEqual(errors, self.errors(*expected))

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

expected = [B018(line, 0) for line in range(9, 21)]
expected = [
B018(9, 0, vars=("Constant",)),
B018(10, 0, vars=("Constant",)),
B018(11, 0, vars=("Constant",)),
B018(12, 0, vars=("Constant",)),
B018(13, 0, vars=("Constant",)),
B018(14, 0, vars=("Constant",)),
B018(15, 0, vars=("Constant",)),
B018(16, 0, vars=("List",)),
B018(17, 0, vars=("Set",)),
B018(18, 0, vars=("Dict",)),
B018(19, 0, vars=("Tuple",)),
B018(20, 0, vars=("Tuple",)),
]
self.assertEqual(errors, self.errors(*expected))

def test_b019(self):
Expand Down

0 comments on commit 6fb2eee

Please sign in to comment.