4 # Author: David Goodger <goodger@python.org>
5 # Copyright: This module has been placed in the public domain.
8 Test module for misc.Transitions transform.
11 from __init__
import DocutilsTestSupport
# must be imported before docutils
12 from docutils
.transforms
.misc
import Transitions
13 from docutils
.parsers
.rst
import Parser
17 s
= DocutilsTestSupport
.TransformTestSuite(parser
)
18 s
.generateTests(totest
)
24 totest
['transitions'] = ((Transitions
,), [
42 <document source="test data">
43 <section ids="section-1" names="section\ 1">
46 <section ids="subsection-1" names="subsection\ 1">
52 <section ids="section-2" names="section\ 2">
69 <document source="test data">
73 <section ids="section-1" names="section\ 1">
82 A section or document may not begin with a transition.
84 The DTD specifies that two transitions may not
93 The DTD also specifies that a section or document
94 may not end with a transition.
99 <document source="test data">
100 <system_message level="3" line="1" source="test data" type="ERROR">
102 Document or section may not begin with a transition.
105 A section or document may not begin with a transition.
107 The DTD specifies that two transitions may not
110 <system_message level="3" line="10" source="test data" type="ERROR">
112 At least one body element must separate transitions; adjacent transitions are not allowed.
114 <system_message level="3" line="12" source="test data" type="ERROR">
116 At least one body element must separate transitions; adjacent transitions are not allowed.
119 The DTD also specifies that a section or document
120 may not end with a transition.
122 <system_message level="3" line="17" source="test data" type="ERROR">
124 Document may not end with a transition.
127 Sections with transitions at beginning and end.
134 The next transition is legal:
144 <document source="test data">
146 Sections with transitions at beginning and end.
147 <section ids="section-1" names="section\ 1">
150 <system_message level="3" line="6" source="test data" type="ERROR">
152 Document or section may not begin with a transition.
155 The next transition is legal:
157 <section ids="section-2" names="section\ 2">
160 <system_message level="3" line="15" source="test data" type="ERROR">
162 Document or section may not begin with a transition.
164 <system_message level="3" line="15" source="test data" type="ERROR">
166 Document may not end with a transition.
169 A paragraph and two transitions.
176 <document source="test data">
178 A paragraph and two transitions.
180 <system_message level="3" line="5" source="test data" type="ERROR">
182 At least one body element must separate transitions; adjacent transitions are not allowed.
184 <system_message level="3" line="5" source="test data" type="ERROR">
186 Document may not end with a transition.
189 A paragraph, two transitions, and a blank line.
197 <document source="test data">
199 A paragraph, two transitions, and a blank line.
201 <system_message level="3" line="5" source="test data" type="ERROR">
203 At least one body element must separate transitions; adjacent transitions are not allowed.
205 <system_message level="3" line="5" source="test data" type="ERROR">
207 Document may not end with a transition.
212 Document beginning with a transition.
215 <document source="test data">
216 <system_message level="3" line="1" source="test data" type="ERROR">
218 Document or section may not begin with a transition.
221 Document beginning with a transition.
239 <document source="test data">
240 <section ids="section-1" names="section\ 1">
243 <system_message level="3" line="4" source="test data" type="ERROR">
245 Document or section may not begin with a transition.
247 <system_message level="3" line="6" source="test data" type="ERROR">
249 At least one body element must separate transitions; adjacent transitions are not allowed.
251 <system_message level="3" line="8" source="test data" type="ERROR">
253 At least one body element must separate transitions; adjacent transitions are not allowed.
255 <section ids="section-2" names="section\ 2">
269 <document source="test data">
270 <system_message level="3" line="1" source="test data" type="ERROR">
272 Document or section may not begin with a transition.
274 <system_message level="3" line="3" source="test data" type="ERROR">
276 At least one body element must separate transitions; adjacent transitions are not allowed.
278 <system_message level="3" line="5" source="test data" type="ERROR">
280 At least one body element must separate transitions; adjacent transitions are not allowed.
282 <system_message level="3" line="5" source="test data" type="ERROR">
284 Document may not end with a transition.
293 <document source="test data">
297 <system_message level="3" line="3" source="test data" type="ERROR">
299 Document may not end with a transition.
304 if __name__
== '__main__':
306 unittest
.main(defaultTest
='suite')