def test_rule_031(self): oRule = if_statement.rule_031() self.assertTrue(oRule) self.assertEqual(oRule.name, 'if') self.assertEqual(oRule.identifier, '031') dExpected = [utils.add_violation(23)] oRule.analyze(self.oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_031(self): oRule = if_statement.rule_031() dExpected = [] oRule.fix(self.oFile) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, dExpected) self.assertEqual(self.oFile.lines[22].line, ' X <= \'1\'; -- This should be an error') self.assertEqual(self.oFile.lines[23].isBlank, True) self.assertEqual(self.oFile.lines[24].line, ' if (A = \'1\' and B = \'1\') then')
def test_fix_rule_031(self): oRule = if_statement.rule_031() oRule.allow_comments = True oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_031(self): oRule = if_statement.rule_031() oRule.allow_comments = True self.assertTrue(oRule) self.assertEqual(oRule.name, 'if') self.assertEqual(oRule.identifier, '031') lExpected = [36] oRule.analyze(self.oFile) self.assertEqual( lExpected, utils.extract_violation_lines_from_violation_object( oRule.violations))