コード例 #1
0
 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')
コード例 #2
0
 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())
コード例 #3
0
 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')
コード例 #4
0
 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')
コード例 #5
0
 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())
コード例 #6
0
 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 (*&^%$#@!)")
コード例 #7
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())
コード例 #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())
コード例 #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())
コード例 #10
0
 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')
コード例 #11
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())
コード例 #12
0
 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())
コード例 #13
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')
コード例 #14
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())
コード例 #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())
コード例 #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')
コード例 #17
0
 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')
コード例 #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')
コード例 #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(),
                      "áúőóüöáé ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬")
コード例 #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 (*&^%$#@!)")
コード例 #21
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 (*&^%$#@!)")
コード例 #22
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')
コード例 #23
0
 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(),
                      "áúőóüöáé ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬")
コード例 #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')
コード例 #25
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')
コード例 #26
0
    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)