コード例 #1
0
 def test_no_comment(self):
     """There is no comment above the bug line."""
     sp_handler = SourceSuppressHandler(_get_bug(self.__tmp_srcfile_1, 9))
     res = sp_handler.check_source_suppress()
     self.assertFalse(res)
     self.assertEqual(sp_handler.suppressed_checkers(), [])
     self.assertIsNone(sp_handler.suppress_comment())
コード例 #2
0
 def test_multi_liner_all(self):
     """There is suppress comment above the bug line."""
     sp_handler = SourceSuppressHandler(_get_bug(self.__tmp_srcfile_1, 23))
     res = sp_handler.check_source_suppress()
     self.assertTrue(res)
     self.assertEqual(sp_handler.suppressed_checkers(), ['all'])
     self.assertEqual(sp_handler.suppress_comment(), 'some long comment')
コード例 #3
0
 def test_malformed_commment_format(self):
     """Check malformed comment."""
     sp_handler = SourceSuppressHandler(_get_bug(self.__tmp_srcfile_2, 1))
     res = sp_handler.check_source_suppress()
     self.assertFalse(res)
     self.assertEqual(sp_handler.suppressed_checkers(), [])
     self.assertIsNone(sp_handler.suppress_comment())
コード例 #4
0
 def test_suppress_first_line(self):
     """Bug is reported for the first line."""
     test_handler = SourceSuppressHandler(_get_bug(self.__tmp_srcfile_1, 3))
     res = test_handler.check_source_suppress()
     self.assertFalse(res)
     self.assertEqual(test_handler.suppressed_checkers(), [])
     self.assertIsNone(test_handler.suppress_comment())
コード例 #5
0
 def test_multi_liner_some_checkers(self):
     """There is suppress comment above the bug line."""
     sp_handler = SourceSuppressHandler(self.__tmp_srcfile_1, 50)
     res = sp_handler.check_source_suppress()
     self.assertFalse(res)
     self.assertEqual(sp_handler.suppressed_checkers(), [])
     self.assertIsNone(sp_handler.suppress_comment())
コード例 #6
0
 def test_no_suppress_comment(self):
     """There is suppress comment above the bug line."""
     sp_handler = SourceSuppressHandler(self.__tmp_srcfile_1, 16)
     res = sp_handler.check_source_suppress()
     self.assertTrue(res)
     self.assertEqual(sp_handler.suppressed_checkers(), ['all'])
     self.assertEqual(sp_handler.suppress_comment(), 'some comment')
コード例 #7
0
 def test_no_fancy_comment(self):
     """Check no fancy comment."""
     sp_handler = SourceSuppressHandler(_get_bug(self.__tmp_srcfile_1, 70))
     res = sp_handler.check_source_suppress()
     self.assertTrue(res)
     self.assertEqual(sp_handler.suppressed_checkers(), ['my_checker_1'])
     self.assertEqual(sp_handler.suppress_comment(),
                      'WARNING! suppress comment is missing')
コード例 #8
0
 def test_fancy_comment_characters(self):
     """Check fancy comment."""
     sp_handler = SourceSuppressHandler(_get_bug(self.__tmp_srcfile_1, 64))
     res = sp_handler.check_source_suppress()
     self.assertTrue(res)
     self.assertEqual(sp_handler.suppressed_checkers(), ['my_checker_1'])
     self.assertEqual(sp_handler.suppress_comment(),
                      "áúőóüöáé ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬")
コード例 #9
0
 def test_comment_characters(self):
     """Check for different special comment characters."""
     sp_handler = SourceSuppressHandler(_get_bug(self.__tmp_srcfile_1, 57))
     res = sp_handler.check_source_suppress()
     self.assertTrue(res)
     self.assertEqual(sp_handler.suppressed_checkers(),
                      ['my.checker_1', 'my.checker_2'])
     self.assertEqual(sp_handler.suppress_comment(), "i/';0 (*&^%$#@!)")
コード例 #10
0
 def test_one_liner_some_checkers(self):
     """There is suppress comment above the bug line."""
     sp_handler = SourceSuppressHandler(_get_bug(self.__tmp_srcfile_1, 43))
     res = sp_handler.check_source_suppress()
     self.assertTrue(res)
     self.assertEqual(sp_handler.suppressed_checkers(),
                      ['my.Checker_1', 'my.Checker_2'])
     self.assertEqual(sp_handler.suppress_comment(),
                      'some really really long comment')