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

        lExpected = [4, 5]
        oRule.analyze(self.oFile)
        self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)
    def test_fix_rule_002_lower(self):
        oRule = signal.rule_002()

        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_002(self):
     oRule = signal.rule_002()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'signal')
     self.assertEqual(oRule.identifier, '002')
     lExpected = [{
         'line_number': 7,
         'words_to_fix': {'Signal'}
     }, {
         'line_number': 11,
         'words_to_fix': {'siGNal'}
     }, {
         'line_number': 13,
         'words_to_fix': {'signAL'}
     }]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, lExpected)
示例#5
0
    def test_rule_002(self):
        oRule = signal.rule_002()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'signal')
        self.assertEqual(oRule.identifier, '002')
        lExpected = []
        dViolation = utils.add_violation(7)
        dViolation['words_to_fix'] = {'Signal'}
        lExpected.append(dViolation)

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

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

        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, lExpected)
示例#6
0
 def test_fix_rule_002(self):
     oRule = signal.rule_002()
     dExpected = []
     oRule.fix(self.oFile)
     oRule.analyze(self.oFile)
     self.assertEqual(oRule.violations, dExpected)