def test_rule_007(self): oRule = generic.rule_007() self.assertTrue(oRule) self.assertEqual(oRule.name, 'generic') self.assertEqual(oRule.identifier, '007') dExpected = [22, 36, 37, 67] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_007_lower(self): oRule = generic.rule_007() 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_007(self): oRule = generic.rule_007() self.assertTrue(oRule) self.assertEqual(oRule.name, 'generic') self.assertEqual(oRule.identifier, '007') dExpected = [{'line_number': 22, 'words_to_fix': {'G_generic2'}}, {'line_number': 36, 'words_to_fix': {'g_generIC1'}}, {'line_number': 37, 'words_to_fix': {'G_GeneRIC2'}}, {'line_number': 67, 'words_to_fix': {'A_generic1'}}] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_007_upper(self): oRule = generic.rule_007() oRule.case = 'upper' self.assertTrue(oRule) self.assertEqual(oRule.name, 'generic') self.assertEqual(oRule.identifier, '007') lExpected = [17, 18, 19] oRule.analyze(self.oFile) self.assertEqual( utils.extract_violation_lines_from_violation_object( oRule.violations), lExpected)
def test_rule_007(self): oRule = generic.rule_007() self.assertTrue(oRule) self.assertEqual(oRule.name, 'generic') self.assertEqual(oRule.identifier, '007') dExpected = [{'lines':[{'number': 22}], 'words_to_fix': {'G_generic2'}}, {'lines':[{'number': 36}], 'words_to_fix': {'g_generIC1'}}, {'lines':[{'number': 37}], 'words_to_fix': {'G_GeneRIC2'}}, {'lines':[{'number': 67}], 'words_to_fix': {'A_generic1'}}, {'lines':[{'number': 83}], 'words_to_fix': {'G_GENERIC1'}}, {'lines':[{'number': 84}], 'words_to_fix': {'G_GENERIC2'}}, {'lines':[{'number': 116}], 'words_to_fix': {'A_GENERIC2'}}, {'lines':[{'number': 139}], 'words_to_fix': {'G_GENERIC1'}}, {'lines':[{'number': 156}], 'words_to_fix': {'G_GENERIC2'}}, {'lines':[{'number': 170}], 'words_to_fix': {'G_GENERIC1'}}, {'lines':[{'number': 171}], 'words_to_fix': {'G_GENERIC2'}}] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_007(self): oRule = generic.rule_007() oRule.fix(oFile) oRule.analyze(oFile) self.assertEqual(oRule.violations, [])