17
by Jonathan Lange
LICENSE it as MIT. |
1 |
# Copyright (c) 2007-2010 testdoc authors. See LICENSE for details.
|
2 |
||
5
by jml@canonical.com
Split out the formatter code into a separate module. |
3 |
import StringIO |
4 |
import unittest |
|
5 |
||
6 |
from testdoc.formatter import WikiFormatter |
|
7 |
||
8 |
||
9 |
class WikiFormatterTest(unittest.TestCase): |
|
10 |
def setUp(self): |
|
11 |
self.stream = StringIO.StringIO() |
|
12 |
self.formatter = WikiFormatter(self.stream) |
|
13 |
||
14 |
def test_title(self): |
|
15 |
self.formatter.title('foo') |
|
16 |
self.assertEqual(self.stream.getvalue(), '= foo =\n\n') |
|
17 |
||
18 |
def test_section(self): |
|
19 |
self.formatter.section('foo') |
|
15
by Jonathan Lange
Fix a bug in the tests. |
20 |
self.assertEqual(self.stream.getvalue(), '\n== foo ==\n\n') |
5
by jml@canonical.com
Split out the formatter code into a separate module. |
21 |
|
22 |
def test_subsection(self): |
|
23 |
self.formatter.subsection('foo') |
|
24 |
self.assertEqual(self.stream.getvalue(), '=== foo ===\n\n') |
|
25 |
||
26 |
def test_paragraph(self): |
|
27 |
self.formatter.paragraph('\nfoo\nbar\n') |
|
28 |
self.assertEqual(self.stream.getvalue(), 'foo\nbar\n\n') |