コード例 #1
0
    def test_fix_rule_033(self):
        oRule = if_statement.rule_033()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
コード例 #2
0
    def test_rule_033(self):
        oRule = if_statement.rule_033()
        lExpected = []
        oRule.fix(oFileIf)
        oRule.analyze(oFileIf)
        self.assertEqual(oFileIf.lines[24].indentLevel, 2)
        self.assertEqual(oFileIf.lines[25].indentLevel, 2)

        self.assertEqual(oFileIf.lines[24].line, '    -- and finally comments for the')
        self.assertEqual(oFileIf.lines[25].line, '    -- else code')

        self.assertEqual(oRule.violations, lExpected)
コード例 #3
0
    def test_rule_033(self):
        oRule = if_statement.rule_033()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'if')
        self.assertEqual(oRule.identifier, '033')

        lExpected = [33, 39, 41]

        oRule.analyze(self.oFile)
        self.assertEqual(
            lExpected,
            utils.extract_violation_lines_from_violation_object(
                oRule.violations))
コード例 #4
0
 def test_rule_033(self):
     oRule = if_statement.rule_033()
     self.assertTrue(oRule)
     self.assertEqual(oRule.name, 'if')
     self.assertEqual(oRule.identifier, '033')
     lExpected = [{
         'lines': [{
             'number': 25
         }],
         'indent': 2
     }, {
         'lines': [{
             'number': 24
         }],
         'indent': 2
     }]
     oRule.analyze(oFileIf)
     self.assertEqual(oRule.violations, lExpected)