Ejemplo n.º 1
0
    def test_rule_012_lowercase(self):
        oRule = generate.rule_012()
        oRule.case = 'lower'

        dExpected = [9,29,34,39,44,49,54,58,62,75,79,81,86,106]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
    def test_rule_012_uppercase(self):
        oRule = generate.rule_012()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'generate')
        self.assertEqual(oRule.identifier, '012')

        dExpected = [{
            'line_number': 14,
            'words_to_fix': {'generate_1'}
        }, {
            'line_number': 19,
            'words_to_fix': {'generate_1'}
        }, {
            'line_number': 73,
            'words_to_fix': {'generate_3'}
        }, {
            'line_number': 96,
            'words_to_fix': {'generate_3'}
        }, {
            'line_number': 98,
            'words_to_fix': {'generate_2'}
        }, {
            'line_number': 100,
            'words_to_fix': {'generate_1'}
        }]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
Ejemplo n.º 3
0
 def test_fix_rule_012(self):
     oRule = generate.rule_012()
     oRule.fix(self.oFile)
     oRule.analyze(self.oFile)
     self.assertEqual(oRule.violations, [])
     self.assertEqual(self.oFile.lines[14].line, '   end generate GENERATE_1;')
     self.assertEqual(self.oFile.lines[19].line, 'END GENERATE GENERATE_1;')
     self.assertEqual(self.oFile.lines[73].line, '      end generate GENERATE_3;')
Ejemplo n.º 4
0
    def test_rule_012(self):
        oRule = generate.rule_012()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'generate')
        self.assertEqual(oRule.identifier, '012')

        dExpected = [14,19,73]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
Ejemplo n.º 5
0
    def test_fix_rule_012_lower(self):
        oRule = generate.rule_012()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_lower, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Ejemplo n.º 6
0
    def test_fix_rule_012_lowercase(self):
        oRule = generate.rule_012()
        oRule.fix(self.oFile)
        self.assertEqual(self.oFile.lines[9].line,
                         '  end generate generate_1;')
        self.assertEqual(self.oFile.lines[79].line,
                         '    end generate generate_4;')
        self.assertEqual(self.oFile.lines[106].line,
                         '    end generate generate_1;')

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
Ejemplo n.º 7
0
    def test_rule_012_lower(self):
        oRule = generate.rule_012()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'generate')
        self.assertEqual(oRule.identifier, '012')

        lExpected = [8, 12, 16]

        oRule.analyze(self.oFile)
        self.assertEqual(
            utils.extract_violation_lines_from_violation_object(
                oRule.violations), lExpected)
Ejemplo n.º 8
0
    def test_rule_012_upper(self):
        oRule = generate.rule_012()
        oRule.case = 'upper'
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'generate')
        self.assertEqual(oRule.identifier, '012')

        lExpected = [22, 26, 30]

        oRule.analyze(self.oFile)
        self.assertEqual(
            utils.extract_violation_lines_from_violation_object(
                oRule.violations), lExpected)
    def test_rule_012_lowercase(self):
        oRule = generate.rule_012()
        oRule.case = 'lower'

        dExpected = [{
            'line_number': 9,
            'words_to_fix': {'GENERATE_1'}
        }, {
            'line_number': 29,
            'words_to_fix': {'GENERATE_1'}
        }, {
            'line_number': 34,
            'words_to_fix': {'GENERATE_1'}
        }, {
            'line_number': 39,
            'words_to_fix': {'GENERATE_1'}
        }, {
            'line_number': 44,
            'words_to_fix': {'GENERATE_1'}
        }, {
            'line_number': 49,
            'words_to_fix': {'GENERATE_1'}
        }, {
            'line_number': 54,
            'words_to_fix': {'GENERATE_1'}
        }, {
            'line_number': 58,
            'words_to_fix': {'GENERATE_1'}
        }, {
            'line_number': 62,
            'words_to_fix': {'GENERATE_1'}
        }, {
            'line_number': 75,
            'words_to_fix': {'GENERATE_2'}
        }, {
            'line_number': 79,
            'words_to_fix': {'GENERATE_4'}
        }, {
            'line_number': 81,
            'words_to_fix': {'GENERATE_1'}
        }, {
            'line_number': 86,
            'words_to_fix': {'GENERATE_1'}
        }, {
            'line_number': 106,
            'words_to_fix': {'GENERATE_1'}
        }]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
Ejemplo n.º 10
0
    def test_rule_012_lowercase(self):
        oRule = generate.rule_012()

        dExpected = [{'lines':[{'number': 9}], 'words_to_fix': {'GENERATE_1'}},
                     {'lines':[{'number': 29}], 'words_to_fix': {'GENERATE_1'}},
                     {'lines':[{'number': 34}], 'words_to_fix': {'GENERATE_1'}},
                     {'lines':[{'number': 39}], 'words_to_fix': {'GENERATE_1'}},
                     {'lines':[{'number': 44}], 'words_to_fix': {'GENERATE_1'}},
                     {'lines':[{'number': 49}], 'words_to_fix': {'GENERATE_1'}},
                     {'lines':[{'number': 54}], 'words_to_fix': {'GENERATE_1'}},
                     {'lines':[{'number': 58}], 'words_to_fix': {'GENERATE_1'}},
                     {'lines':[{'number': 62}], 'words_to_fix': {'GENERATE_1'}},
                     {'lines':[{'number': 75}], 'words_to_fix': {'GENERATE_2'}},
                     {'lines':[{'number': 79}], 'words_to_fix': {'GENERATE_4'}},
                     {'lines':[{'number': 81}], 'words_to_fix': {'GENERATE_1'}},
                     {'lines':[{'number': 86}], 'words_to_fix': {'GENERATE_1'}},
                     {'lines':[{'number': 106}], 'words_to_fix': {'GENERATE_1'}}]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)