Initial import to Tizen
[profile/ivi/python-twisted.git] / twisted / lore / test / test_docbook.py
1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 """
5 Tests for L{twisted.lore.docbook}.
6 """
7
8 from xml.dom.minidom import Element, Text
9
10 from twisted.trial.unittest import TestCase
11 from twisted.lore.docbook import DocbookSpitter
12
13
14 class DocbookSpitterTests(TestCase):
15     """
16     Tests for L{twisted.lore.docbook.DocbookSpitter}.
17     """
18     def test_li(self):
19         """
20         L{DocbookSpitter} wraps any non-I{p} elements found intside any I{li}
21         elements with I{p} elements.
22         """
23         output = []
24         spitter = DocbookSpitter(output.append)
25
26         li = Element('li')
27         li.appendChild(Element('p'))
28         text = Text()
29         text.data = 'foo bar'
30         li.appendChild(text)
31
32         spitter.visitNode(li)
33         self.assertEqual(
34             ''.join(output),
35             '<listitem><para></para><para>foo bar</para></listitem>')