remove unused or duplicate imports (mercurial)
[docutils.git] / test / test_transforms / test_messages.py
blob1fcb04ebdb5298bdfa547604bc7514ffc3f7e0e8
1 #! /usr/bin/env python
3 # $Id$
4 # Author: David Goodger <goodger@python.org>
5 # Copyright: This module has been placed in the public domain.
7 """
8 Tests for docutils.transforms.universal.Messages.
9 """
11 from __init__ import DocutilsTestSupport
12 from docutils.transforms.universal import Messages
13 from docutils.transforms.references import Substitutions
14 from docutils.parsers.rst import Parser
17 def suite():
18 parser = Parser()
19 s = DocutilsTestSupport.TransformTestSuite(parser)
20 s.generateTests(totest)
21 return s
23 totest = {}
25 totest['system_message_sections'] = ((Substitutions, Messages), [
26 ["""\
27 This |unknown substitution| will generate a system message, thanks to
28 the ``Substitutions`` transform. The ``Messages`` transform will
29 generate a "System Messages" section.
31 (A second copy of the system message is tacked on to the end of the
32 document by the test framework.)
33 """,
34 """\
35 <document source="test data">
36 <paragraph>
37 This \n\
38 <problematic ids="id2" refid="id1">
39 |unknown substitution|
40 will generate a system message, thanks to
41 the \n\
42 <literal>
43 Substitutions
44 transform. The \n\
45 <literal>
46 Messages
47 transform will
48 generate a "System Messages" section.
49 <paragraph>
50 (A second copy of the system message is tacked on to the end of the
51 document by the test framework.)
52 <section classes="system-messages">
53 <title>
54 Docutils System Messages
55 <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
56 <paragraph>
57 Undefined substitution referenced: "unknown substitution".
58 """],
62 if __name__ == '__main__':
63 import unittest
64 unittest.main(defaultTest='suite')