def test_rule_019(self): oRule = port.rule_019() self.assertTrue(oRule) self.assertEqual(oRule.name, 'port') self.assertEqual(oRule.identifier, '019') lExpected = [] dViolation = utils.add_violation(40) dViolation['words_to_fix'] = {'IN'} lExpected.append(dViolation) dViolation = utils.add_violation(43) dViolation['words_to_fix'] = {'iN'} lExpected.append(dViolation) dViolation = utils.add_violation(44) dViolation['words_to_fix'] = {'oUt'} lExpected.append(dViolation) dViolation = utils.add_violation(45) dViolation['words_to_fix'] = {'inOut'} lExpected.append(dViolation) oRule.analyze(oFile) self.assertEqual(oRule.violations, lExpected)
def test_rule_019(self): oRule = port.rule_019() self.assertTrue(oRule) self.assertEqual(oRule.name, 'port') self.assertEqual(oRule.identifier, '019') dExpected = [40,43,44,45] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_019_upper(self): oRule = port.rule_019() oRule.case = 'upper' self.assertTrue(oRule) self.assertEqual(oRule.name, 'port') self.assertEqual(oRule.identifier, '019') lExpected = [4, 5, 6, 7] oRule.analyze(self.oFile) self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)
def test_rule_019_lower(self): oRule = port.rule_019() self.assertTrue(oRule) self.assertEqual(oRule.name, 'port') self.assertEqual(oRule.identifier, '019') lExpected = [14, 15, 16, 17] oRule.analyze(self.oFile) self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)
def test_fix_rule_019_lower(self): oRule = port.rule_019() 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_019(self): oRule = port.rule_019() self.assertTrue(oRule) self.assertEqual(oRule.name, 'port') self.assertEqual(oRule.identifier, '019') dExpected = [{ 'line_number': 40, 'words_to_fix': {'IN'} }, { 'line_number': 43, 'words_to_fix': {'iN'} }, { 'line_number': 44, 'words_to_fix': {'oUt'} }, { 'line_number': 45, 'words_to_fix': {'inOut'} }] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_rule_019(self): oRule = port.rule_019() oRule.fix(self.oFile) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])