def test_rule_003(self):
        oRule = entity.rule_003()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'entity')
        self.assertEqual(oRule.identifier, '003')

        dExpected = [34]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
Ejemplo n.º 2
0
    def test_rule_003_w_require_comment(self):
        oRule = entity.rule_003()
        oRule.style = 'require_comment'

        lExpected = [8, 21, 26]

        oRule.analyze(self.oFile)
        self.assertEqual(
            lExpected,
            utils.extract_violation_lines_from_violation_object(
                oRule.violations))
Ejemplo n.º 3
0
    def test_rule_003_w_no_code(self):
        oRule = entity.rule_003()
        oRule.style = 'no_code'

        lExpected = [8]

        oRule.analyze(self.oFile)
        self.assertEqual(
            lExpected,
            utils.extract_violation_lines_from_violation_object(
                oRule.violations))
Ejemplo n.º 4
0
    def test_fix_rule_003_w_require_blank(self):
        oRule = entity.rule_003()
        oRule.style = 'require_blank_line'

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_require_blank, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Ejemplo n.º 5
0
    def test_fix_rule_003_w_allow_comment(self):
        oRule = entity.rule_003()
        oRule.style = 'allow_comment'

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_allow_comment, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Ejemplo n.º 6
0
    def test_rule_003_w_require_blank(self):
        oRule = entity.rule_003()
        oRule.style = 'require_blank_line'

        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'entity')
        self.assertEqual(oRule.identifier, '003')

        lExpected = [3, 8, 18, 24]

        oRule.analyze(self.oFile)
        self.assertEqual(
            lExpected,
            utils.extract_violation_lines_from_violation_object(
                oRule.violations))
Ejemplo n.º 7
0
    def test_fix_rule_003_w_require_comment(self):
        oRule = entity.rule_003()
        oRule.style = 'require_comment'

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_require_comment, lActual)

        lExpected = [8, 27]

        oRule.analyze(self.oFile)
        self.assertEqual(
            lExpected,
            utils.extract_violation_lines_from_violation_object(
                oRule.violations))
 def test_fix_rule_003(self):
     oRule = entity.rule_003()
     oRule.fix(oFile)
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, [])