aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/lore/test/test_docbook.py
blob: 4bec127f0a9b2f51e88d66326a8da4a4565be4cb (plain)
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
29
30
31
32
33
34
35
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
Tests for L{twisted.lore.docbook}.
"""

from xml.dom.minidom import Element, Text

from twisted.trial.unittest import TestCase
from twisted.lore.docbook import DocbookSpitter


class DocbookSpitterTests(TestCase):
    """
    Tests for L{twisted.lore.docbook.DocbookSpitter}.
    """
    def test_li(self):
        """
        L{DocbookSpitter} wraps any non-I{p} elements found intside any I{li}
        elements with I{p} elements.
        """
        output = []
        spitter = DocbookSpitter(output.append)

        li = Element('li')
        li.appendChild(Element('p'))
        text = Text()
        text.data = 'foo bar'
        li.appendChild(text)

        spitter.visitNode(li)
        self.assertEqual(
            ''.join(output),
            '<listitem><para></para><para>foo bar</para></listitem>')