Spelling fixes
[docutils.git] / test / test_parsers / test_rst / test_transitions.py
bloba6782a25c85cd07e2f7772198b0986879bdce4e8
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 transition markers.
9 """
11 from __init__ import DocutilsTestSupport
13 def suite():
14 s = DocutilsTestSupport.ParserTestSuite()
15 s.generateTests(totest)
16 return s
18 totest = {}
20 # See DocutilsTestSupport.ParserTestSuite.generateTests for a
21 # description of the 'totest' data structure.
22 totest['transitions'] = [
23 ["""\
24 Test transition markers.
26 --------
28 Paragraph
29 """,
30 """\
31 <document source="test data">
32 <paragraph>
33 Test transition markers.
34 <transition>
35 <paragraph>
36 Paragraph
37 """],
38 ["""\
39 Section 1
40 =========
41 First text division of section 1.
43 --------
45 Second text division of section 1.
47 Section 2
48 ---------
49 Paragraph 2 in section 2.
50 """,
51 """\
52 <document source="test data">
53 <section ids="section-1" names="section\ 1">
54 <title>
55 Section 1
56 <paragraph>
57 First text division of section 1.
58 <transition>
59 <paragraph>
60 Second text division of section 1.
61 <section ids="section-2" names="section\ 2">
62 <title>
63 Section 2
64 <paragraph>
65 Paragraph 2 in section 2.
66 """],
67 ["""\
68 --------
70 A section or document may not begin with a transition.
72 The DTD specifies that two transitions may not
73 be adjacent:
75 --------
77 --------
79 --------
81 The DTD also specifies that a section or document
82 may not end with a transition.
84 --------
85 """,
86 """\
87 <document source="test data">
88 <transition>
89 <paragraph>
90 A section or document may not begin with a transition.
91 <paragraph>
92 The DTD specifies that two transitions may not
93 be adjacent:
94 <transition>
95 <transition>
96 <transition>
97 <paragraph>
98 The DTD also specifies that a section or document
99 may not end with a transition.
100 <transition>
101 """],
102 ["""\
103 Test unexpected transition markers.
105 Block quote.
107 --------
109 Paragraph.
110 """,
111 """\
112 <document source="test data">
113 <paragraph>
114 Test unexpected transition markers.
115 <block_quote>
116 <paragraph>
117 Block quote.
118 <system_message level="4" line="5" source="test data" type="SEVERE">
119 <paragraph>
120 Unexpected section title or transition.
121 <literal_block xml:space="preserve">
122 --------
123 <paragraph>
124 Paragraph.
125 """],
126 ["""\
127 Short transition marker.
131 Paragraph
132 """,
133 """\
134 <document source="test data">
135 <paragraph>
136 Short transition marker.
137 <paragraph>
139 <paragraph>
140 Paragraph
141 """],
142 ["""\
143 Sections with transitions at beginning and end.
145 Section 1
146 =========
148 ----------
150 The next transition is legal:
152 ----------
154 Section 2
155 =========
157 ----------
158 """,
159 """\
160 <document source="test data">
161 <paragraph>
162 Sections with transitions at beginning and end.
163 <section ids="section-1" names="section\ 1">
164 <title>
165 Section 1
166 <transition>
167 <paragraph>
168 The next transition is legal:
169 <transition>
170 <section ids="section-2" names="section\ 2">
171 <title>
172 Section 2
173 <transition>
174 """],
175 ["""\
176 A paragraph, two transitions, and a blank line.
178 ----------
180 ----------
182 """,
183 """\
184 <document source="test data">
185 <paragraph>
186 A paragraph, two transitions, and a blank line.
187 <transition>
188 <transition>
189 """],
190 ["""\
191 A paragraph and two transitions.
193 ----------
195 ----------
196 """, # the same:
197 """\
198 <document source="test data">
199 <paragraph>
200 A paragraph and two transitions.
201 <transition>
202 <transition>
203 """],
204 ["""\
205 ----------
207 Document beginning with a transition.
208 """,
209 """\
210 <document source="test data">
211 <transition>
212 <paragraph>
213 Document beginning with a transition.
214 """],
215 ["""\
216 Section 1
217 =========
219 Subsection 1
220 ------------
222 Some text.
224 ----------
226 Section 2
227 =========
229 Some text.
230 """,
231 """\
232 <document source="test data">
233 <section ids="section-1" names="section\ 1">
234 <title>
235 Section 1
236 <section ids="subsection-1" names="subsection\ 1">
237 <title>
238 Subsection 1
239 <paragraph>
240 Some text.
241 <transition>
242 <section ids="section-2" names="section\ 2">
243 <title>
244 Section 2
245 <paragraph>
246 Some text.
247 """],
248 ["""\
249 Section 1
250 =========
252 ----------
254 ----------
256 ----------
258 Section 2
259 =========
261 Some text.
262 """,
263 """\
264 <document source="test data">
265 <section ids="section-1" names="section\ 1">
266 <title>
267 Section 1
268 <transition>
269 <transition>
270 <transition>
271 <section ids="section-2" names="section\ 2">
272 <title>
273 Section 2
274 <paragraph>
275 Some text.
276 """],
277 ["""\
278 ----------
280 ----------
282 ----------
283 """,
284 """\
285 <document source="test data">
286 <transition>
287 <transition>
288 <transition>
289 """],
290 ["""\
291 A paragraph.
293 ----------
295 """,
296 """\
297 <document source="test data">
298 <paragraph>
299 A paragraph.
300 <transition>
301 """],
305 if __name__ == '__main__':
306 import unittest
307 unittest.main(defaultTest='suite')