def test_fix_rule_006_lowercase(self): oRule = entity.rule_006() oRule.fix(self.oFile) self.assertEqual(self.oFile.lines[19].line, ' entITy entiTY2 is') oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_006_uppercase(self): oRule = entity.rule_006() oRule.case = 'upper' dExpected = [{ 'line_number': 3, 'words_to_fix': {'is'} }, { 'line_number': 34, 'words_to_fix': {'is'} }, { 'line_number': 65, 'words_to_fix': {'is'} }, { 'line_number': 80, 'words_to_fix': {'is'} }, { 'line_number': 94, 'words_to_fix': {'is'} }, { 'line_number': 113, 'words_to_fix': {'is'} }, { 'line_number': 127, 'words_to_fix': {'is'} }, { 'line_number': 138, 'words_to_fix': {'is'} }] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_006_uppercase(self): oRule = entity.rule_006() oRule.case = 'upper' dExpected = [3, 34, 65, 80, 94, 113, 127, 138] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_006_uppercase(self): oRule = entity.rule_006() oRule.case = 'upper' oRule.fix(self.oFile) self.assertEqual(self.oFile.lines[3].line, 'entity ENTITY1 IS') oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_006(self): oRule = entity.rule_006() self.assertTrue(oRule) self.assertEqual(oRule.name, 'entity') self.assertEqual(oRule.identifier, '006') dExpected = [19] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_006_lowercase(self): oRule = entity.rule_006() self.assertTrue(oRule) self.assertEqual(oRule.name, 'entity') self.assertEqual(oRule.identifier, '006') dExpected = [{'lines': [{'number': 19}], 'words_to_fix': {'IS'}}] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_006_lower(self): oRule = entity.rule_006() 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_006_upper(self): oRule = entity.rule_006() oRule.case = 'upper' self.assertTrue(oRule) self.assertEqual(oRule.name, 'entity') self.assertEqual(oRule.identifier, '006') lExpected = [2, 10] oRule.analyze(self.oFile) self.assertEqual( utils.extract_violation_lines_from_violation_object( oRule.violations), lExpected)
def test_rule_006_uppercase(self): oRule = entity.rule_006() oRule.case = 'upper' dExpected = [{ 'lines': [{ 'number': 3 }], 'words_to_fix': {'is'} }, { 'lines': [{ 'number': 34 }], 'words_to_fix': {'is'} }, { 'lines': [{ 'number': 65 }], 'words_to_fix': {'is'} }, { 'lines': [{ 'number': 80 }], 'words_to_fix': {'is'} }, { 'lines': [{ 'number': 94 }], 'words_to_fix': {'is'} }, { 'lines': [{ 'number': 113 }], 'words_to_fix': {'is'} }, { 'lines': [{ 'number': 127 }], 'words_to_fix': {'is'} }, { 'lines': [{ 'number': 138 }], 'words_to_fix': {'is'} }, { 'lines': [{ 'number': 150 }], 'words_to_fix': {'is'} }] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_006(self): oRule = entity.rule_006() oRule.fix(oFile) oRule.analyze(oFile) self.assertEqual(oRule.violations, [])