def test_rule_002(self):
     oRule = variable.rule_002()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'variable')
     self.assertEqual(oRule.identifier, '002')
     dExpected = [7, 11, 13]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Esempio n. 2
0
    def test_rule_002_upper(self):
        oRule = variable.rule_002()
        oRule.case = 'upper'
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'variable')
        self.assertEqual(oRule.identifier, '002')

        lExpected = [4, 9]
        oRule.analyze(self.oFile)
        self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)
 def test_rule_002(self):
     oRule = variable.rule_002()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'variable')
     self.assertEqual(oRule.identifier, '002')
     dExpected = [{'line_number': 7, 'words_to_fix': {'Variable'}},
                  {'line_number': 11, 'words_to_fix': {'varIAble'}},
                  {'line_number': 13, 'words_to_fix': {'variabLE'}}]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Esempio n. 4
0
    def test_fix_rule_002_lower(self):
        oRule = variable.rule_002()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_lower, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Esempio n. 5
0
    def test_rule_002(self):
        oRule = variable.rule_002()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'variable')
        self.assertEqual(oRule.identifier, '002')
        lExpected = []
        dViolation = utils.add_violation(7)
        dViolation['words_to_fix'] = {'Variable'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(11)
        dViolation['words_to_fix'] = {'varIAble'}
        lExpected.append(dViolation)

        dViolation = utils.add_violation(13)
        dViolation['words_to_fix'] = {'variabLE'}
        lExpected.append(dViolation)

        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, lExpected)
Esempio n. 6
0
 def test_fix_rule_002(self):
     oRule = variable.rule_002()
     dExpected = []
     oRule.fix(self.oFile)
     oRule.analyze(self.oFile)
     self.assertEqual(oRule.violations, dExpected)