Add support for `imenu` and `which-func-mode`. Remember setting
[docutils/kirr.git] / prest / t / 20_directive / topics.init / test_topics.py
blobbfc38e6d52059340fbf3d12df6b1105bdc333422
1 #! /usr/bin/env python
3 # Author: David Goodger
4 # Contact: goodger@users.sourceforge.net
5 # Revision: $Revision: 3199 $
6 # Date: $Date: 2005-10-06 10:35:16 -0500 (Thu, 06 Oct 2005) $
7 # Copyright: This module has been placed in the public domain.
9 """
10 Tests for the "topic" directive.
11 """
13 from __init__ import DocutilsTestSupport
15 def suite():
16 s = DocutilsTestSupport.ParserTestSuite()
17 s.generateTests(totest)
18 return s
20 totest = {}
22 totest['topics'] = [
23 ["""\
24 .. topic::
25 """,
26 """\
27 <document source="test data">
28 <system_message level="3" line="1" source="test data" type="ERROR">
29 <paragraph>
30 Error in "topic" directive:
31 1 argument(s) required, 0 supplied.
32 <literal_block xml:space="preserve">
33 .. topic::
34 """],
35 ["""\
36 .. topic:: Title
37 """,
38 """\
39 <document source="test data">
40 <system_message level="2" line="1" source="test data" type="WARNING">
41 <paragraph>
42 Content block expected for the "topic" directive; none found.
43 <literal_block xml:space="preserve">
44 .. topic:: Title
45 """],
46 ["""\
47 .. topic:: Title
49 Body.
50 """,
51 """\
52 <document source="test data">
53 <topic>
54 <title>
55 Title
56 <paragraph>
57 Body.
58 """],
59 ["""\
60 .. topic::
62 Title
64 Body.
65 """,
66 """\
67 <document source="test data">
68 <system_message level="3" line="1" source="test data" type="ERROR">
69 <paragraph>
70 Error in "topic" directive:
71 1 argument(s) required, 0 supplied.
72 <literal_block xml:space="preserve">
73 .. topic::
74 \n\
75 Title
76 \n\
77 Body.
78 """],
79 ["""\
80 .. topic:: Title
81 Body.
82 """,
83 """\
84 <document source="test data">
85 <system_message level="2" line="1" source="test data" type="WARNING">
86 <paragraph>
87 Content block expected for the "topic" directive; none found.
88 <literal_block xml:space="preserve">
89 .. topic:: Title
90 Body.
91 """],
92 ["""\
93 .. topic::
95 Title
96 Body.
97 """,
98 """\
99 <document source="test data">
100 <system_message level="3" line="1" source="test data" type="ERROR">
101 <paragraph>
102 Error in "topic" directive:
103 1 argument(s) required, 0 supplied.
104 <literal_block xml:space="preserve">
105 .. topic::
107 Title
108 Body.
109 """],
110 ["""\
111 .. topic:: Title
113 .. topic:: Nested
115 Body.
116 """,
117 """\
118 <document source="test data">
119 <topic>
120 <title>
121 Title
122 <system_message level="3" line="3" source="test data" type="ERROR">
123 <paragraph>
124 The "topic" directive may not be used within topics or body elements.
125 <literal_block xml:space="preserve">
126 .. topic:: Nested
128 Body.
129 """],
130 ["""\
131 .. topic:: Title
133 .. topic:: Nested
135 Body.
136 More.
137 """,
138 """\
139 <document source="test data">
140 <topic>
141 <title>
142 Title
143 <system_message level="3" line="3" source="test data" type="ERROR">
144 <paragraph>
145 The "topic" directive may not be used within topics or body elements.
146 <literal_block xml:space="preserve">
147 .. topic:: Nested
149 Body.
150 <system_message level="2" line="6" source="test data" type="WARNING">
151 <paragraph>
152 Explicit markup ends without a blank line; unexpected unindent.
153 <paragraph>
154 More.
155 """],
156 ["""\
157 .. topic:: Title
159 .. topic:: Nested
161 Body.
163 More.
165 More.
166 """,
167 """\
168 <document source="test data">
169 <topic>
170 <title>
171 Title
172 <system_message level="3" line="3" source="test data" type="ERROR">
173 <paragraph>
174 The "topic" directive may not be used within topics or body elements.
175 <literal_block xml:space="preserve">
176 .. topic:: Nested
178 Body.
179 <paragraph>
180 More.
181 <paragraph>
182 More.
183 """],
184 ["""\
185 .. topic:: First
187 Body
189 .. topic:: Second
191 Body.
192 """,
193 """\
194 <document source="test data">
195 <topic>
196 <title>
197 First
198 <paragraph>
199 Body
200 <topic>
201 <title>
202 Second
203 <paragraph>
204 Body.
205 """],
206 ["""\
207 .. sidebar:: Title
208 :subtitle: Outer
210 .. topic:: Nested
212 Body.
214 More.
216 More.
217 """,
218 """\
219 <document source="test data">
220 <sidebar>
221 <title>
222 Title
223 <subtitle>
224 Outer
225 <topic>
226 <title>
227 Nested
228 <paragraph>
229 Body.
230 <paragraph>
231 More.
232 <paragraph>
233 More.
234 """],
238 if __name__ == '__main__':
239 import unittest
240 unittest.main(defaultTest='suite')