def test_rule_003_lowercase(self):
     oRule = for_loop.rule_003()
     dExpected = [{
         'lines': [{
             'number': 40
         }],
         'words_to_fix': {'Label'}
     }, {
         'lines': [{
             'number': 44
         }],
         'words_to_fix': {'LABEL'}
     }, {
         'lines': [{
             'number': 48
         }],
         'words_to_fix': {'LABEL'}
     }, {
         'lines': [{
             'number': 52
         }],
         'words_to_fix': {'LABEL'}
     }, {
         'lines': [{
             'number': 56
         }],
         'words_to_fix': {'LABEL'}
     }]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
 def test_rule_003_uppercase(self):
     oRule = for_loop.rule_003()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'for_loop')
     self.assertEqual(oRule.identifier, '003')
     dExpected = [36, 40]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
 def test_rule_003_uppercase(self):
     oRule = for_loop.rule_003()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'for_loop')
     self.assertEqual(oRule.identifier, '003')
     dExpected = [{'line_number': 36, 'words_to_fix': {'label'}},
                  {'line_number': 40, 'words_to_fix': {'Label'}}]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Пример #4
0
 def test_fix_rule_003(self):
     oRule = for_loop.rule_003()
     dExpected = []
     oRule.fix(self.oFile)
     oRule.analyze(self.oFile)
     self.assertEqual(self.oFile.lines[36].line, '    LABEL : for index in 10 to 200 loop')
     self.assertEqual(self.oFile.lines[40].line, '    LABEL: for index in 10 to 200 loop')
     self.assertEqual(self.oFile.lines[44].line, '    LABEL :for index in 10 to 200 loop')
     self.assertEqual(oRule.violations, dExpected)
 def test_rule_003_lowercase(self):
     oRule = for_loop.rule_003()
     oRule.case = 'lower'
     dExpected = [{'line_number': 40, 'words_to_fix': {'Label'}},
                  {'line_number': 44, 'words_to_fix': {'LABEL'}},
                  {'line_number': 48, 'words_to_fix': {'LABEL'}},
                  {'line_number': 52, 'words_to_fix': {'LABEL'}},
                  {'line_number': 56, 'words_to_fix': {'LABEL'}}]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
Пример #6
0
    def test_fix_rule_003_lower(self):
        oRule = for_loop.rule_003()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_lower, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Пример #7
0
    def test_rule_003_upper(self):
        oRule = for_loop.rule_003()
        oRule.case = 'upper'
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'for_loop')
        self.assertEqual(oRule.identifier, '003')

        lExpected = [9, 17]
        oRule.analyze(self.oFile)
        self.assertEqual(
            utils.extract_violation_lines_from_violation_object(
                oRule.violations), lExpected)
    def test_fix_rule_003_lowercase(self):
        oRule = for_loop.rule_003()
        oRule.case = 'lower'
        dExpected = []
        oRule.fix(self.oFile)
        self.assertEqual(self.oFile.lines[36].line,
                         '    label : for index in 10 to 200 loop')
        self.assertEqual(self.oFile.lines[40].line,
                         '    label: for index in 10 to 200 loop')
        self.assertEqual(self.oFile.lines[44].line,
                         '    label :for index in 10 to 200 loop')

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, dExpected)
 def test_rule_003_lowercase(self):
     oRule = for_loop.rule_003()
     oRule.case = 'lower'
     dExpected = [40, 44, 48, 52, 56]
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)