def test_rule_003(self): oRule = whitespace.rule_003() self.assertTrue(oRule) self.assertEqual(oRule.name, 'whitespace') self.assertEqual(oRule.identifier, '003') lExpected = [4, 5, 11] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
def test_fix_rule_003(self): oRule = whitespace.rule_003() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
def test_003(self): oRule = whitespace.rule_003() self.assertTrue(oRule) self.assertEqual(oRule.name, 'whitespace') self.assertEqual(oRule.identifier, '003') self.assertEqual(oRule.phase, 2) dExpected = [2, 4, 6] self.oFile.lines.append(line.line(' This is a test of tabs;')) self.oFile.lines.append(line.line(' This is a test of tabs ;')) self.oFile.lines.append(line.line(' This is a test of tabs;')) self.oFile.lines.append(line.line(' This is a test of tabs ;')) self.oFile.lines.append(line.line(' This is a test; of tabs')) self.oFile.lines.append(line.line(' This is a test ; of tabs')) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, dExpected)
def test_fix_003(self): oRule = whitespace.rule_003() self.assertTrue(oRule) self.assertEqual(oRule.name, 'whitespace') self.assertEqual(oRule.identifier, '003') oFile = vhdlFile.vhdlFile(sFileName) dExpected = [] oFile.lines.append(line.line(' This is a test of tabs;')) oFile.lines.append(line.line(' This is a test of tabs ;')) oFile.lines.append(line.line(' This is a test of tabs;')) oFile.lines.append(line.line(' This is a test of tabs ;')) oFile.lines.append(line.line(' This is a test; of tabs')) oFile.lines.append(line.line(' This is a test ; of tabs')) oRule.fix(oFile) oRule.analyze(oFile) self.assertEqual(oRule.violations, dExpected)