Пример #1
0
    def test_rule_017(self):
        oRule = port.rule_017()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'port')
        self.assertEqual(oRule.identifier, '017')

        dExpected = [25,39,98]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
Пример #2
0
    def test_fix_rule_017_lower(self):
        oRule = port.rule_017()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_lower, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Пример #3
0
    def test_rule_017_upper(self):
        oRule = port.rule_017()
        oRule.case = 'upper'
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'port')
        self.assertEqual(oRule.identifier, '017')

        lExpected = [3]
        oRule.analyze(self.oFile)
        self.assertEqual(
            utils.extract_violation_lines_from_violation_object(
                oRule.violations), lExpected)
Пример #4
0
    def test_rule_017(self):
        oRule = port.rule_017()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'port')
        self.assertEqual(oRule.identifier, '017')

        dExpected = [{
            'line_number': 25,
            'words_to_fix': {'PORt'}
        }, {
            'line_number': 39,
            'words_to_fix': {'PORt'}
        }, {
            'line_number': 98,
            'words_to_fix': {'Port'}
        }]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
Пример #5
0
    def test_rule_017(self):
        oRule = port.rule_017()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'port')
        self.assertEqual(oRule.identifier, '017')

        lExpected = []
        dViolation = utils.add_violation(25)
        dViolation['words_to_fix'] = {'PORt'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(39)
        dViolation['words_to_fix'] = {'PORt'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(98)
        dViolation['words_to_fix'] = {'Port'}
        lExpected.append(dViolation)

        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, lExpected)
Пример #6
0
 def test_fix_rule_017(self):
     oRule = port.rule_017()
     oRule.fix(self.oFile)
     oRule.analyze(self.oFile)
     self.assertEqual(oRule.violations, [])