def test_rule_005_lowercase(self): oRule = function.rule_005() self.assertTrue(oRule) self.assertEqual(oRule.name, 'function') self.assertEqual(oRule.identifier, '005') dExpected = [36] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_005_lowercase(self): oRule = function.rule_005() dExpected = [] oRule.fix(self.oFile) self.assertEqual(self.oFile.lines[36].line, ' function func_1 (a : integer) return integer is') oRule.analyze(self.oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_005_lowercase(self): oRule = function.rule_005() self.assertTrue(oRule) self.assertEqual(oRule.name, 'function') self.assertEqual(oRule.identifier, '005') dExpected = [{'line_number': 36, 'words_to_fix': {'FUNCTION'}}] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_005_uppercase(self): oRule = function.rule_005() oRule.case = 'upper' dExpected = [ 4, 16, 21, 28, 47, 54, 63, 70, 78, 87, 97, 110, 126, 128, 136, 141, 146 ] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_005_uppercase(self): oRule = function.rule_005() oRule.case = 'upper' dExpected = [{ 'line_number': 4, 'words_to_fix': {'function'} }, { 'line_number': 16, 'words_to_fix': {'function'} }, { 'line_number': 21, 'words_to_fix': {'function'} }, { 'line_number': 28, 'words_to_fix': {'function'} }, { 'line_number': 47, 'words_to_fix': {'function'} }, { 'line_number': 54, 'words_to_fix': {'function'} }, { 'line_number': 63, 'words_to_fix': {'function'} }, { 'line_number': 70, 'words_to_fix': {'function'} }, { 'line_number': 78, 'words_to_fix': {'function'} }, { 'line_number': 87, 'words_to_fix': {'function'} }, { 'line_number': 97, 'words_to_fix': {'function'} }, { 'line_number': 110, 'words_to_fix': {'function'} }, { 'line_number': 126, 'words_to_fix': {'function'} }, { 'line_number': 128, 'words_to_fix': {'function'} }, { 'line_number': 136, 'words_to_fix': {'function'} }, { 'line_number': 141, 'words_to_fix': {'function'} }, { 'line_number': 146, 'words_to_fix': {'function'} }] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_005_lower(self): oRule = function.rule_005() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected_lower, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_fix_rule_005_uppercase(self): oRule = function.rule_005() oRule.case = 'upper' dExpected = [] oRule.fix(self.oFile) self.assertEqual(self.oFile.lines[4].line, ' FUNCTION func_1 (a : integer) return integer is') self.assertEqual(self.oFile.lines[47].line, ' impure FUNCTION func_1 (a : integer) return integer is') self.assertEqual(self.oFile.lines[54].line, ' pure FUNCTION func_1 (a : integer) return integer is') oRule.analyze(self.oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_005_upper(self): oRule = function.rule_005() oRule.case = 'upper' self.assertTrue(oRule) self.assertEqual(oRule.name, 'function') self.assertEqual(oRule.identifier, '005') lExpected = [4, 8] oRule.analyze(self.oFile) self.assertEqual( utils.extract_violation_lines_from_violation_object( oRule.violations), lExpected)
def test_fix_rule_005(self): oRule = function.rule_005() dExpected = [] oRule.fix(oFile) oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_005_uppercase(self): oRule = function.rule_005() oRule.case = 'upper' dExpected = [{ 'lines': [{ 'number': 4 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 16 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 21 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 28 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 47 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 54 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 63 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 70 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 78 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 87 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 97 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 110 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 126 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 128 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 136 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 141 }], 'words_to_fix': {'function'} }, { 'lines': [{ 'number': 146 }], 'words_to_fix': {'function'} }] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)