class TextRendererTest(unittest.TestCase): def setUp(self): self.renderer = TextRenderer(80, MockOutput()) def test_header(self): title = "Test Header\n" self.renderer.header(title) output = "".join(self.renderer.file.buffer) self.assertRegex(output, title) def test_paragraph(self): title = "Test Header\n" p1 = "Paragraph 1\n" self.renderer.header(title) self.renderer.paragraph(p1) output = "".join(self.renderer.file.buffer) self.assertRegex(output, p1) def test_footer(self): title = "Test Header\n" p1 = "Paragraph 1\n" self.renderer.header(title) self.renderer.paragraph(p1) self.renderer.footer() output = "".join(self.renderer.file.buffer) self.assertRegex(output, r".*END OF TEXT PAGE$")