~testdoc-dev/testdoc/trunk.git

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Copyright (c) 2007-2010 testdoc authors. See LICENSE for details.

import StringIO
import unittest

from testdoc.formatter import WikiFormatter


class WikiFormatterTest(unittest.TestCase):
    def setUp(self):
        self.stream = StringIO.StringIO()
        self.formatter = WikiFormatter(self.stream)

    def test_title(self):
        self.formatter.title('foo')
        self.assertEqual(self.stream.getvalue(), '= foo =\n\n')

    def test_section(self):
        self.formatter.section('foo')
        self.assertEqual(self.stream.getvalue(), '\n== foo ==\n\n')

    def test_subsection(self):
        self.formatter.subsection('foo')
        self.assertEqual(self.stream.getvalue(), '=== foo ===\n\n')

    def test_paragraph(self):
        self.formatter.paragraph('\nfoo\nbar\n')
        self.assertEqual(self.stream.getvalue(), 'foo\nbar\n\n')