Spelling fixes
[docutils.git] / test / test_parsers / test_rst / test_comments.py
blob63b548a3820af64c4b111c3cbc577db58db615cf
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 states.py.
9 """
11 from __init__ import DocutilsTestSupport
13 def suite():
14 s = DocutilsTestSupport.ParserTestSuite()
15 s.generateTests(totest)
16 return s
18 totest = {}
20 totest['comments'] = [
21 ["""\
22 .. A comment
24 Paragraph.
25 """,
26 """\
27 <document source="test data">
28 <comment xml:space="preserve">
29 A comment
30 <paragraph>
31 Paragraph.
32 """],
33 ["""\
34 .. A comment
35 block.
37 Paragraph.
38 """,
39 """\
40 <document source="test data">
41 <comment xml:space="preserve">
42 A comment
43 block.
44 <paragraph>
45 Paragraph.
46 """],
47 ["""\
49 A comment consisting of multiple lines
50 starting on the line after the
51 explicit markup start.
52 """,
53 """\
54 <document source="test data">
55 <comment xml:space="preserve">
56 A comment consisting of multiple lines
57 starting on the line after the
58 explicit markup start.
59 """],
60 ["""\
61 .. A comment.
62 .. Another.
64 Paragraph.
65 """,
66 """\
67 <document source="test data">
68 <comment xml:space="preserve">
69 A comment.
70 <comment xml:space="preserve">
71 Another.
72 <paragraph>
73 Paragraph.
74 """],
75 ["""\
76 .. A comment
77 no blank line
79 Paragraph.
80 """,
81 """\
82 <document source="test data">
83 <comment xml:space="preserve">
84 A comment
85 <system_message level="2" line="2" source="test data" type="WARNING">
86 <paragraph>
87 Explicit markup ends without a blank line; unexpected unindent.
88 <paragraph>
89 no blank line
90 <paragraph>
91 Paragraph.
92 """],
93 ["""\
94 .. A comment.
95 .. Another.
96 no blank line
98 Paragraph.
99 """,
100 """\
101 <document source="test data">
102 <comment xml:space="preserve">
103 A comment.
104 <comment xml:space="preserve">
105 Another.
106 <system_message level="2" line="3" source="test data" type="WARNING">
107 <paragraph>
108 Explicit markup ends without a blank line; unexpected unindent.
109 <paragraph>
110 no blank line
111 <paragraph>
112 Paragraph.
113 """],
114 ["""\
115 .. A comment::
117 Paragraph.
118 """,
119 """\
120 <document source="test data">
121 <comment xml:space="preserve">
122 A comment::
123 <paragraph>
124 Paragraph.
125 """],
126 ["""\
128 comment::
130 The extra newline before the comment text prevents
131 the parser from recognizing a directive.
132 """,
133 """\
134 <document source="test data">
135 <comment xml:space="preserve">
136 comment::
137 <paragraph>
138 The extra newline before the comment text prevents
139 the parser from recognizing a directive.
140 """],
141 ["""\
143 _comment: http://example.org
145 The extra newline before the comment text prevents
146 the parser from recognizing a hyperlink target.
147 """,
148 """\
149 <document source="test data">
150 <comment xml:space="preserve">
151 _comment: http://example.org
152 <paragraph>
153 The extra newline before the comment text prevents
154 the parser from recognizing a hyperlink target.
155 """],
156 ["""\
158 [comment] Not a citation.
160 The extra newline before the comment text prevents
161 the parser from recognizing a citation.
162 """,
163 """\
164 <document source="test data">
165 <comment xml:space="preserve">
166 [comment] Not a citation.
167 <paragraph>
168 The extra newline before the comment text prevents
169 the parser from recognizing a citation.
170 """],
171 ["""\
173 |comment| image:: bogus.png
175 The extra newline before the comment text prevents
176 the parser from recognizing a substitution definition.
177 """,
178 """\
179 <document source="test data">
180 <comment xml:space="preserve">
181 |comment| image:: bogus.png
182 <paragraph>
183 The extra newline before the comment text prevents
184 the parser from recognizing a substitution definition.
185 """],
186 ["""\
187 .. Next is an empty comment, which serves to end this comment and
188 prevents the following block quote being swallowed up.
192 A block quote.
193 """,
194 """\
195 <document source="test data">
196 <comment xml:space="preserve">
197 Next is an empty comment, which serves to end this comment and
198 prevents the following block quote being swallowed up.
199 <comment xml:space="preserve">
200 <block_quote>
201 <paragraph>
202 A block quote.
203 """],
204 ["""\
205 term 1
206 definition 1
208 .. a comment
210 term 2
211 definition 2
212 """,
213 """\
214 <document source="test data">
215 <definition_list>
216 <definition_list_item>
217 <term>
218 term 1
219 <definition>
220 <paragraph>
221 definition 1
222 <comment xml:space="preserve">
223 a comment
224 <definition_list_item>
225 <term>
226 term 2
227 <definition>
228 <paragraph>
229 definition 2
230 """],
231 ["""\
232 term 1
233 definition 1
235 .. a comment
237 term 2
238 definition 2
239 """,
240 """\
241 <document source="test data">
242 <definition_list>
243 <definition_list_item>
244 <term>
245 term 1
246 <definition>
247 <paragraph>
248 definition 1
249 <comment xml:space="preserve">
250 a comment
251 <definition_list>
252 <definition_list_item>
253 <term>
254 term 2
255 <definition>
256 <paragraph>
257 definition 2
258 """],
259 ["""\
260 + bullet paragraph 1
262 bullet paragraph 2
264 .. comment between bullet paragraphs 2 and 3
266 bullet paragraph 3
267 """,
268 """\
269 <document source="test data">
270 <bullet_list bullet="+">
271 <list_item>
272 <paragraph>
273 bullet paragraph 1
274 <paragraph>
275 bullet paragraph 2
276 <comment xml:space="preserve">
277 comment between bullet paragraphs 2 and 3
278 <paragraph>
279 bullet paragraph 3
280 """],
281 ["""\
282 + bullet paragraph 1
284 .. comment between bullet paragraphs 1 (leader) and 2
286 bullet paragraph 2
287 """,
288 """\
289 <document source="test data">
290 <bullet_list bullet="+">
291 <list_item>
292 <paragraph>
293 bullet paragraph 1
294 <comment xml:space="preserve">
295 comment between bullet paragraphs 1 (leader) and 2
296 <paragraph>
297 bullet paragraph 2
298 """],
299 ["""\
300 + bullet
302 .. trailing comment
303 """,
304 """\
305 <document source="test data">
306 <bullet_list bullet="+">
307 <list_item>
308 <paragraph>
309 bullet
310 <comment xml:space="preserve">
311 trailing comment
312 """],
315 if __name__ == '__main__':
316 import unittest
317 unittest.main(defaultTest='suite')