def test_one_liner_some_checkers(self):
     """doc"""
     sp_handler = SourceSuppressHandler(self.__tmp_sourcefile, 41)
     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')
 def test_multi_liner_some_checkers(self):
     """doc"""
     sp_handler = SourceSuppressHandler(self.__tmp_sourcefile, 48)
     res = sp_handler.check_source_suppress()
     self.assertFalse(res)
     self.assertEqual(sp_handler.suppressed_checkers(), [])
     self.assertIsNone(sp_handler.suppress_comment())
 def test_multi_liner_all(self):
     """ there is suppress comment above the bug line"""
     sp_handler = SourceSuppressHandler(self.__tmp_sourcefile, 34)
     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 long comment')
 def test_no_suppress_comment(self):
     """ there is suppress comment above the bug line"""
     sp_handler = SourceSuppressHandler(self.__tmp_sourcefile, 14)
     res = sp_handler.check_source_suppress()
     self.assertTrue(res)
     self.assertEqual(sp_handler.suppressed_checkers(), ['all'])
     self.assertEqual(sp_handler.suppress_comment(), 'some comment')
 def test_no_comment(self):
     """ there is no comment above the bug line"""
     sp_handler = SourceSuppressHandler(self.__tmp_sourcefile, 7)
     res = sp_handler.check_source_suppress()
     self.assertFalse(res)
     self.assertEqual(sp_handler.suppressed_checkers(), [])
     self.assertIsNone(sp_handler.suppress_comment())
 def test_comment_characters(self):
     """"""
     sp_handler = SourceSuppressHandler(self.__tmp_sourcefile, 55)
     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 (*&^%$#@!)")
 def test_malformed_commment_format(self):
     """Check malformed comment."""
     sp_handler = SourceSuppressHandler(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())
Exemple #8
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())
Exemple #9
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())
 def test_multi_liner_all(self):
     """There is suppress comment above the bug line."""
     sp_handler = SourceSuppressHandler(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')
 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())
 def test_suppress_first_line(self):
     """Bug is reported for the first line."""
     test_handler = SourceSuppressHandler(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())
 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')
 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())
Exemple #15
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())
Exemple #16
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')
 def test_no_comment(self):
     """ check fancy comment"""
     sp_handler = SourceSuppressHandler(self.__tmp_sourcefile, 68)
     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')
Exemple #18
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')
Exemple #19
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(),
                      "áúőóüöáé ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬")
Exemple #20
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 (*&^%$#@!)")
 def test_comment_characters(self):
     """Check for different special comment characters."""
     sp_handler = SourceSuppressHandler(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 (*&^%$#@!)")
 def test_one_liner_all(self):
     """There is suppress comment above the bug line."""
     sp_handler = SourceSuppressHandler(_get_bug(self.__tmp_srcfile_1, 29))
     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 comment')
 def test_fancy_comment_characters(self):
     """ check fancy comment"""
     sp_handler = SourceSuppressHandler(self.__tmp_sourcefile, 62)
     res = sp_handler.check_source_suppress()
     self.assertTrue(res)
     self.assertEqual(sp_handler.suppressed_checkers(), ['my_checker_1'])
     self.assertEqual(sp_handler.suppress_comment(),
                      "áúőóüöáé ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬")
Exemple #24
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')
 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')
    def test_malformed_commment_format(self):
        """"""
        test_sourcefile = self.__make_tempfile(test_file_content_2)

        sp_handler = SourceSuppressHandler(test_sourcefile, 1)
        res = sp_handler.check_source_suppress()
        self.assertFalse(res)
        self.assertEqual(sp_handler.suppressed_checkers(), [])
        self.assertIsNone(sp_handler.suppress_comment())

        os.remove(test_sourcefile)