def test_rule_002(self): oRule = after.rule_002() self.assertTrue(oRule) self.assertEqual(oRule.name, 'after') self.assertEqual(oRule.identifier, '002') self.assertTrue(oRule.disable) lExpected = ['48-63', '92-98'] oRule.analyze(oFile) self.assertEqual(oRule.violations, lExpected)
def test_rule_002(self): oRule = after.rule_002() self.assertTrue(oRule) self.assertEqual(oRule.name, 'after') self.assertEqual(oRule.identifier, '002') lExpected = [33, 34, 35, 36] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
def test_fix_rule_002(self): oRule = after.rule_002() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_002(self): oRule = after.rule_002() self.assertTrue(oRule) self.assertEqual(oRule.name, 'after') self.assertEqual(oRule.identifier, '002') self.assertTrue(oRule.disable) lExpected = [{'lines': [{'number': 93, 'keyword_column': 16, 'before_keyword_column': 12}, {'number': 94, 'keyword_column': 15, 'before_keyword_column': 12}, {'number': 95, 'keyword_column': 17, 'before_keyword_column': 12}, {'number': 96, 'keyword_column': 14, 'before_keyword_column': 12}], 'max_keyword_column': 17, 'max_before_keyword_column': 12}] oRule.analyze(oFile) self.assertEqual(oRule.violations, lExpected)
def test_fix_rule_002(self): oRule = after.rule_002() oRule.fix(self.oFile) self.assertEqual(self.oFile.lines[50].line, ' after 1 ns;') self.assertEqual(self.oFile.lines[52].line, ' after') self.assertEqual(self.oFile.lines[56].line, ' after') self.assertEqual(self.oFile.lines[61].line, ' d <= e after 1 ns;') self.assertEqual(self.oFile.lines[93].line, ' a <= b after 1 ns;') self.assertEqual(self.oFile.lines[94].line, ' b <= c after 1 ns;') self.assertEqual(self.oFile.lines[95].line, ' c <= d after 1 ns;') self.assertEqual(self.oFile.lines[96].line, ' d <= e after 1 ns;') lExpected = [] oRule.analyze(self.oFile) self.assertEqual(oRule.violations, lExpected)