示例#1
0
    def test_rule_002(self):
        oRule = file_statement.rule_002()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'file')
        self.assertEqual(oRule.identifier, '002')

        dExpected = [{'line_number': 9, 'words_to_fix': {'FILE'}}]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
    def test_rule_002(self):
        oRule = file_statement.rule_002()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'file')
        self.assertEqual(oRule.identifier, '002')

        dExpected = [9]
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)
示例#3
0
 def test_fix_rule_002(self):
     oRule = file_statement.rule_002()
     lExpected = []
     oRule.fix(self.oFile)
     oRule.analyze(self.oFile)
     self.assertEqual(oRule.violations, lExpected)
     self.assertEqual(
         self.oFile.lines[9].line,
         '   file     defaultImage : load_file_type open read_mode is load_file_name;'
     )
    def test_fix_rule_002_lower(self):
        oRule = file_statement.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_upper(self):
        oRule = file_statement.rule_002()
        oRule.case = 'upper'
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'file')
        self.assertEqual(oRule.identifier, '002')

        lExpected = [4, 8]
        oRule.analyze(self.oFile)
        self.assertEqual(
            utils.extract_violation_lines_from_violation_object(
                oRule.violations), lExpected)