Пример #1
0
 def test_rule_001_with_75_character_limit(self):
     oRule = length.rule_001()
     oRule.length = 75
     dExpected = utils.add_violation_list([1,3,4,7,9])
     oRule.analyze(oFile)
     self.assertEqual(oRule.violations, dExpected)
     self.assertEqual('Reduce line to less than 75 characters', oRule._get_solution(0))
Пример #2
0
    def test_rule_001_with_default(self):
        oRule = length.rule_001()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'length')
        self.assertEqual(oRule.identifier, '001')
        dExpected = utils.add_violation_list([3,7,9])
        oRule.analyze(oFile)
        self.assertEqual(oRule.violations, dExpected)

        self.assertEqual('Reduce line to less than 120 characters', oRule._get_solution(0))
Пример #3
0
    def test_rule_001_with_125_characters(self):
        oRule = length.rule_001()
        oRule.length = 125

        lExpected = [3, 9]

        oRule.analyze(self.oFile)
        self.assertEqual(
            lExpected,
            utils.extract_violation_lines_from_violation_object(
                oRule.violations))
Пример #4
0
    def test_rule_001_default(self):
        oRule = length.rule_001()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'length')
        self.assertEqual(oRule.identifier, '001')

        lExpected = [3, 7, 9]

        oRule.analyze(self.oFile)
        self.assertEqual(
            lExpected,
            utils.extract_violation_lines_from_violation_object(
                oRule.violations))