Пример #1
0
 def test_rule_012(self):
     oRule = process.rule_012()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'process')
     self.assertEqual(oRule.identifier, '012')
     dExpected = [10, 15, 33]
     oRule.analyze(self.oFile)
     self.assertEqual(oRule.violations, dExpected)
 def test_rule_012(self):
     oRule = process.rule_012()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'process')
     self.assertEqual(oRule.identifier, '012')
     dExpected = utils.add_violation_list([51, 57])
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Пример #3
0
    def test_rule_012_remove(self):
        oRule = process.rule_012()
        oRule.action = 'remove'

        lExpected = [7, 11]

        oRule.analyze(self.oFile)
        self.assertEqual(
            lExpected,
            utils.extract_violation_lines_from_violation_object(
                oRule.violations))
Пример #4
0
    def test_fix_rule_012_add(self):
        oRule = process.rule_012()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_add, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Пример #5
0
    def test_rule_012_add(self):
        oRule = process.rule_012()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'process')
        self.assertEqual(oRule.identifier, '012')

        lExpected = [17, 21]

        oRule.analyze(self.oFile)
        self.assertEqual(
            lExpected,
            utils.extract_violation_lines_from_violation_object(
                oRule.violations))
    def test_fix_rule_012(self):
        oRule = process.rule_012()
        dExpected = []
        self.assertFalse(self.oFile.lines[51].isProcessIs)
        self.assertFalse(self.oFile.lines[57].isProcessIs)
        oRule.fix(self.oFile)
        self.assertEqual(self.oFile.lines[51].line, '  process (one, two, three) is ')
        self.assertEqual(self.oFile.lines[57].line, '           three) is ')
        self.assertTrue(self.oFile.lines[51].isProcessIs)
        self.assertTrue(self.oFile.lines[57].isProcessIs)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, dExpected)
Пример #7
0
    def test_fix_rule_012(self):
        oRule = process.rule_012()
        oRule.fix(self.oFile)
        self.assertEqual(self.oFile.lines[10].line,
                         '  PROC1 : process (a, b, c) is ')
        self.assertTrue(self.oFile.lines[10].isProcessIs)
        self.assertEqual(self.oFile.lines[11].line, '')
        self.assertTrue(self.oFile.lines[11].isBlank)
        self.assertFalse(self.oFile.lines[11].isProcessIs)

        self.assertEqual(self.oFile.lines[15].line,
                         '  PROC1 : process (a, b, c) is ')
        self.assertTrue(self.oFile.lines[15].isProcessIs)
        self.assertEqual(self.oFile.lines[16].line, '     begin')
        self.assertFalse(self.oFile.lines[16].isProcessIs)

        self.assertEqual(self.oFile.lines[33].line,
                         '  PROC1 : process (a, b, c) is ')
        self.assertTrue(self.oFile.lines[33].isProcessIs)

        dExpected = []
        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, dExpected)
Пример #8
0
 def test_fix_rule_012(self):
     oRule = process.rule_012()
     dExpected = []
     oRule.fix(oFile)
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)