def test_rule_014_uppercase(self): oRule = entity.rule_014() oRule.case = 'upper' dExpected = [{ 'line_number': 16, 'words_to_fix': {'entity'} }, { 'line_number': 33, 'words_to_fix': {'entity'} }, { 'line_number': 63, 'words_to_fix': {'entity'} }, { 'line_number': 78, 'words_to_fix': {'ENtity'} }, { 'line_number': 91, 'words_to_fix': {'entity'} }, { 'line_number': 123, 'words_to_fix': {'entity'} }, { 'line_number': 133, 'words_to_fix': {'entity'} }, { 'line_number': 146, 'words_to_fix': {'entity'} }] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_014_lowercase(self): oRule = entity.rule_014() oRule.fix(self.oFile) self.assertEqual(self.oFile.lines[78].line, 'end entity ENTITY1') oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_014_uppercase(self): oRule = entity.rule_014() oRule.case = 'upper' dExpected = [16, 33, 63, 78, 91, 123, 133, 146] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_014_uppercase(self): oRule = entity.rule_014() oRule.case = 'upper' oRule.fix(self.oFile) self.assertEqual(self.oFile.lines[78].line, 'end ENTITY entity1') oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_014(self): oRule = entity.rule_014() self.assertTrue(oRule) self.assertEqual(oRule.name, 'entity') self.assertEqual(oRule.identifier, '014') dExpected = [47, 78] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_014_lowercase(self): oRule = entity.rule_014() self.assertTrue(oRule) self.assertEqual(oRule.name, 'entity') self.assertEqual(oRule.identifier, '014') dExpected = [{'lines':[{'number': 47}], 'words_to_fix': {'ENTITY'}}, {'lines':[{'number': 78}], 'words_to_fix': {'ENtity'}}] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_014_lower(self): oRule = entity.rule_014() 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_014_upper(self): oRule = entity.rule_014() oRule.case = 'upper' self.assertTrue(oRule) self.assertEqual(oRule.name, 'entity') self.assertEqual(oRule.identifier, '014') lExpected = [4, 12] oRule.analyze(self.oFile) self.assertEqual( utils.extract_violation_lines_from_violation_object( oRule.violations), lExpected)
def test_fix_rule_014(self): oRule = entity.rule_014() oRule.fix(oFile) oRule.analyze(oFile) self.assertEqual(oRule.violations, [])