def test_rule_001(self): oRule = for_loop.rule_001() self.assertTrue(oRule) self.assertEqual(oRule.name, 'for_loop') self.assertEqual(oRule.identifier, '001') dExpected = utils.add_violation_list([19,21]) oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_001(self): oRule = for_loop.rule_001() dExpected = [] oRule.fix(self.oFile) oRule.analyze(self.oFile) self.assertEqual(self.oFile.lines[19].line, ' for index in 3 to 72 loop') self.assertEqual(self.oFile.lines[21].line, ' for j in 0 to 32 loop') self.assertEqual(self.oFile.lines[26].line, ' for index in 2 to 16 loop') self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_001(self): oRule = for_loop.rule_001() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_001(self): oRule = for_loop.rule_001() self.assertTrue(oRule) self.assertEqual(oRule.name, 'for_loop') self.assertEqual(oRule.identifier, '001') lExpected = [27, 31, 35, 37] oRule.analyze(self.oFile) self.assertEqual( lExpected, utils.extract_violation_lines_from_violation_object( oRule.violations))
def test_fix_rule_001(self): oRule = for_loop.rule_001() dExpected = [] oRule.fix(oFile) oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)