class TestCase(DefaultTestFixture): def setUp(self): DefaultTestFixture.setUp(self) self.formatter = SGMLFormatter() return def test_complete_output(self): self.formatter.open_tag('html') self.formatter.open_tag('title') self.formatter.add_text('title text') self.formatter.close_tag() self.formatter.open_tag('body') self.formatter.add_text('body text') self.formatter.single_tag('br') self.formatter.open_close_tag('img', src='image_source', x='image_x', y='image_y') self.formatter.close_tag('body') output = self.formatter.output_complete() self.failUnless(output == _html, 'output = %r\n\nhtml = %r' % (output, _html)) def test_partial_output(self): self.formatter.open_tag('html') self.formatter.open_tag('title') self.formatter.add_text('title text') self.formatter.close_tag() output = self.formatter.output() self.failUnless(output == _html[0:35], 'output = %r\n\nhtml = %r' % (output, _html[0:35])) self.formatter.open_tag('body') output = self.formatter.output() self.failUnless(output == _html[35:43], 'output = %r\n\nhtml = %r' % (output, _html[35:43])) self.formatter.add_text('body text') self.formatter.single_tag('br') self.formatter.open_close_tag('img', src='image_source', x='image_x', y='image_y') self.formatter.close_tag('body') self.formatter.close_tag() output = self.formatter.output() self.failUnless(output == _html[43:], 'output = %r\n\nhtml = %r' % (output, _html[43:]))