Exemple #1
0
 def test_no_headers(self):
     paragraphs = self.get_paragraphs(two_fp_without_header)
     rule = CheckHasHeader(paragraphs)
     self.assertFalse(rule.apply())
     self.assertEqual(len(rule.messages), 1)
     msg = rule.messages[0]
     self.assertEqual(msg.line_number, 1)
     self.assertEqual(msg.position, 1)
     self.assertEqual(msg.txt, "You need define the header paragraph")
Exemple #2
0
 def test_two_headers(self):
     data = two_headers + two_fp_without_header
     paragraphs = self.get_paragraphs(data)
     rule = CheckHasHeader(paragraphs)
     self.assertFalse(rule.apply())
     self.assertEqual(len(rule.messages), 1)
     msg = rule.messages[0]
     self.assertEqual(msg.line_number, 1)
     self.assertEqual(msg.position, 1)
     self.assertEqual(msg.txt, "Just one header paragraph is allowed")
Exemple #3
0
 def test_ok(self):
     data = header + two_fp_without_header
     paragraphs = self.get_paragraphs(data)
     rule = CheckHasHeader(paragraphs)
     self.assertTrue(rule.apply())