def test_rule_004(self): oRule = for_loop.rule_004() self.assertTrue(oRule) self.assertEqual(oRule.name, 'for_loop') self.assertEqual(oRule.identifier, '004') dExpected = utils.add_violation_list([40,48]) oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_004(self): oRule = for_loop.rule_004() dExpected = [] oRule.fix(self.oFile) oRule.analyze(self.oFile) self.assertEqual(self.oFile.lines[40].line, ' Label : for index in 10 to 200 loop') self.assertEqual(self.oFile.lines[48].line, ' LABEL : for index in 10 to 200 loop') self.assertEqual(self.oFile.lines[52].line, ' LABEL : for index in 10 to 200 loop') self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_004(self): oRule = for_loop.rule_004() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_004(self): oRule = for_loop.rule_004() self.assertTrue(oRule) self.assertEqual(oRule.name, 'for_loop') self.assertEqual(oRule.identifier, '004') lExpected = [13, 17] oRule.analyze(self.oFile) self.assertEqual( lExpected, utils.extract_violation_lines_from_violation_object( oRule.violations))
def test_rule_004(self): oRule = for_loop.rule_004() self.assertTrue(oRule) self.assertEqual(oRule.name, 'for_loop') self.assertEqual(oRule.identifier, '004') lExpected = [] dViolation = utils.add_violation(40) dViolation['label'] = 'Label' lExpected.append(dViolation) dViolation = utils.add_violation(48) dViolation['label'] = 'LABEL' lExpected.append(dViolation) oRule.analyze(oFile) self.assertEqual(oRule.violations, lExpected)