def test_S003(self):
     bbc = SentryCheck(filename=path("S003.py"))
     errors = list(bbc.run())
     assert errors == [
         (
             1,
             0,
             "S003: Use ``from sentry.utils import json`` instead.",
             SentryCheck,
         ),
         (
             2,
             0,
             "S003: Use ``from sentry.utils import json`` instead.",
             SentryCheck,
         ),
         (
             3,
             0,
             "S003: Use ``from sentry.utils import json`` instead.",
             SentryCheck,
         ),
         (
             4,
             0,
             "S003: Use ``from sentry.utils import json`` instead.",
             SentryCheck,
         ),
     ]
Esempio n. 2
0
 def test_b007(self):
     bbc = SentryCheck(filename=path("b007.py"))
     errors = list(bbc.run())
     self.assertEqual(
         errors,
         self.errors(
             B007(10, 4, vars=("i", )),
             B007(22, 12, vars=("k", )),
             B007(34, 4, vars=("i", )),
             B007(34, 12, vars=("k", )),
         ),
     )
 def test_b006_b008(self):
     bbc = SentryCheck(filename=path("b006_b008.py"))
     errors = list(bbc.run())
     self.assertEqual(
         errors,
         self.errors(
             B006(14, 24),
             B006(18, 29),
             B006(22, 19),
             B006(26, 19),
             B008(39, 38),
         ),
     )
 def test_b005(self):
     bbc = SentryCheck(filename=path("b005.py"))
     errors = list(bbc.run())
     self.assertEqual(
         errors,
         self.errors(
             B005(4, 0),
             B005(7, 0),
             B005(10, 0),
             B005(13, 0),
             B005(16, 0),
             B005(19, 0),
         ),
     )
Esempio n. 5
0
 def test_b005(self):
     bbc = SentryCheck(filename=path("b005.py"))
     errors = list(bbc.run())
     self.assertEqual(
         errors,
         self.errors(
             B005(6, 0),
             B005(9, 0),
             B005(12, 0),
             B005(15, 0),
             B005(18, 0),
             B005(21, 0),
         ),
     )
Esempio n. 6
0
 def test_b006_b008(self):
     bbc = SentryCheck(filename=path("b006_b008.py"))
     errors = list(bbc.run())
     self.assertEqual(
         errors,
         self.errors(
             B006(16, 24),
             B006(20, 29),
             B006(24, 19),
             B006(28, 19),
             # B006(32, 31),
             B008(41, 38),
             # B006(55, 32),
         ),
     )
Esempio n. 7
0
 def test_b301_b302_b305(self):
     bbc = SentryCheck(filename=path("b301_b302_b305.py"))
     errors = list(bbc.run())
     self.assertEqual(
         errors,
         self.errors(
             B301(34, 4),
             B301(35, 4),
             B301(36, 4),
             B301(37, 4),
             B302(38, 4),
             B302(39, 4),
             B302(40, 4),
             B302(41, 4),
             B305(42, 4),
             B305(43, 4),
         ),
     )
Esempio n. 8
0
 def test_b314(self):
     bbc = SentryCheck(filename=path("b314.py"))
     errors = list(bbc.run())
     self.assertEqual(errors, self.errors(B314(3, 0)))
Esempio n. 9
0
 def test_b004(self):
     bbc = SentryCheck(filename=path("b004.py"))
     errors = list(bbc.run())
     self.assertEqual(errors, self.errors(B004(8, 7), B004(10, 7)))
Esempio n. 10
0
 def test_b003(self):
     bbc = SentryCheck(filename=path("b003.py"))
     errors = list(bbc.run())
     self.assertEqual(errors, self.errors(B003(7, 0)))
Esempio n. 11
0
 def test_b002(self):
     bbc = SentryCheck(filename=path("b002.py"))
     errors = list(bbc.run())
     self.assertEqual(errors, self.errors(B002(12, 8), B002(17, 11)))
Esempio n. 12
0
 def test_b001(self):
     bbc = SentryCheck(filename=path("b001.py"))
     errors = list(bbc.run())
     self.assertEqual(errors, self.errors(B001(5, 0), B001(37, 4)))
Esempio n. 13
0
 def errors(self, *errors):
     return [SentryCheck.adapt_error(e) for e in errors]
Esempio n. 14
0
 def test_b009_b010(self):
     bbc = SentryCheck(filename=path("b009_b010.py"))
     errors = list(bbc.run())
     self.assertEqual(errors, self.errors(B009(11, 0), B010(18, 0)))
Esempio n. 15
0
 def test_b303_b304(self):
     bbc = SentryCheck(filename=path("b303_b304.py"))
     errors = list(bbc.run())
     self.assertEqual(errors, self.errors(B303(21, 4), B304(38, 4)))
Esempio n. 16
0
 def test_b102(self):
     bbc = SentryCheck(filename=path("b102.py"))
     errors = list(bbc.run())
     self.assertEqual(errors, self.errors(B102(1, 1)))
Esempio n. 17
0
 def test_b101(self):
     bbc = SentryCheck(filename=path("b101.py"))
     errors = list(bbc.run())
     self.assertEqual(
         errors, self.errors(B101(8, 0, vars=("assert_called_once", ))))