Пример #1
0
 def test_fix_rule_026(self):
     oRule = if_statement.rule_026()
     dExpected = []
     oRule.fix(oFile)
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
     self.assertEqual(oFile.lines[24].line, '    elsif ( z = 45 and f = 45 ) then')
Пример #2
0
 def test_rule_026(self):
     oRule = if_statement.rule_026()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'if')
     self.assertEqual(oRule.identifier, '026')
     dExpected = [24]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Пример #3
0
 def test_rule_026(self):
     oRule = if_statement.rule_026()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'if')
     self.assertEqual(oRule.identifier, '026')
     dExpected = [{'lines': [{'number': 24}], 'words_to_fix': {'ELSIF'}}]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Пример #4
0
    def test_fix_rule_026_lower(self):
        oRule = if_statement.rule_026()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_lower, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Пример #5
0
    def test_rule_026_upper(self):
        oRule = if_statement.rule_026()
        oRule.case = 'upper'
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'if')
        self.assertEqual(oRule.identifier, '026')

        lExpected = [12, 17]
        oRule.analyze(self.oFile)
        self.assertEqual(
            utils.extract_violation_lines_from_violation_object(
                oRule.violations), lExpected)