def test_rule_003(self): oRule = library.rule_003() self.assertTrue(oRule) self.assertEqual(oRule.name, 'library') self.assertEqual(oRule.identifier, '003') dExpected = [21] oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)
def test_rule_003_w_allow_library_clause(self): oRule = library.rule_003() oRule.allow_library_clause = True lExpected = [5] oRule.analyze(self.oFile) self.assertEqual( lExpected, utils.extract_violation_lines_from_violation_object( oRule.violations))
def test_fix_rule_003_w_allow_library_clause(self): oRule = library.rule_003() oRule.allow_library_clause = True oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected_allow_library_clause, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_fix_rule_003(self): oRule = library.rule_003() oRule.style = 'no_code' oRule.allow_library_clause = False oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected_default, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_rule_003(self): oRule = library.rule_003() oRule.style = 'no_code' oRule.allow_library_clause = False self.assertTrue(oRule) self.assertEqual(oRule.name, 'library') self.assertEqual(oRule.identifier, '003') lExpected = [3, 6, 7] oRule.analyze(self.oFile) self.assertEqual( lExpected, utils.extract_violation_lines_from_violation_object( oRule.violations))
def test_fix_rule_003(self): oRule = library.rule_003() oRule.fix(oFile) oRule.analyze(oFile) self.assertEqual(oRule.violations, [])