def test_rule_009(self): oRule = generic.rule_009() self.assertTrue(oRule) self.assertEqual(oRule.name, 'generic') self.assertEqual(oRule.identifier, '009') dExpected = [66, 82, 95] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_009(self): oRule = generic.rule_009() self.assertTrue(oRule) self.assertEqual(oRule.name, 'generic') self.assertEqual(oRule.identifier, '009') dExpected = [{'line_number': 66, 'words_to_fix': {'geneRIC'}}, {'line_number': 82, 'words_to_fix': {'gENEric'}}, {'line_number': 95, 'words_to_fix': {'Generic'}}] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_009_lower(self): oRule = generic.rule_009() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected_lower, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_009_upper(self): oRule = generic.rule_009() oRule.case = 'upper' self.assertTrue(oRule) self.assertEqual(oRule.name, 'generic') self.assertEqual(oRule.identifier, '009') lExpected = [3] oRule.analyze(self.oFile) self.assertEqual( utils.extract_violation_lines_from_violation_object( oRule.violations), lExpected)
def test_fix_rule_009(self): oRule = generic.rule_009() oRule.fix(oFile) oRule.analyze(oFile) self.assertEqual(oRule.violations, [])