3
# Author: David Goodger
4
# Contact: goodger@users.sourceforge.net
5
# Revision: $Revision: 4132 $
6
# Date: $Date: 2005-12-03 03:13:12 +0100 (Sat, 03 Dec 2005) $
7
# Copyright: This module has been placed in the public domain.
10
Test module for misc.Transitions transform.
13
from __init__ import DocutilsTestSupport # must be imported before docutils
14
from docutils.transforms.misc import Transitions
15
from docutils.parsers.rst import Parser
19
s = DocutilsTestSupport.TransformTestSuite(parser)
20
s.generateTests(totest)
26
totest['transitions'] = ((Transitions,), [
44
<document source="test data">
45
<section ids="section-1" names="section\ 1">
48
<section ids="subsection-1" names="subsection\ 1">
54
<section ids="section-2" names="section\ 2">
71
<document source="test data">
75
<section ids="section-1" names="section\ 1">
84
A section or document may not begin with a transition.
86
The DTD specifies that two transitions may not
95
The DTD also specifies that a section or document
96
may not end with a transition.
101
<document source="test data">
102
<system_message level="3" line="1" source="test data" type="ERROR">
104
Document or section may not begin with a transition.
107
A section or document may not begin with a transition.
109
The DTD specifies that two transitions may not
112
<system_message level="3" line="10" source="test data" type="ERROR">
114
At least one body element must separate transitions; adjacent transitions are not allowed.
116
<system_message level="3" line="12" source="test data" type="ERROR">
118
At least one body element must separate transitions; adjacent transitions are not allowed.
121
The DTD also specifies that a section or document
122
may not end with a transition.
124
<system_message level="3" line="17" source="test data" type="ERROR">
126
Document may not end with a transition.
129
Sections with transitions at beginning and end.
136
The next transition is legal:
146
<document source="test data">
148
Sections with transitions at beginning and end.
149
<section ids="section-1" names="section\ 1">
152
<system_message level="3" line="6" source="test data" type="ERROR">
154
Document or section may not begin with a transition.
157
The next transition is legal:
159
<section ids="section-2" names="section\ 2">
162
<system_message level="3" line="15" source="test data" type="ERROR">
164
Document or section may not begin with a transition.
166
<system_message level="3" line="15" source="test data" type="ERROR">
168
Document may not end with a transition.
171
A paragraph and two transitions.
178
<document source="test data">
180
A paragraph and two transitions.
182
<system_message level="3" line="5" source="test data" type="ERROR">
184
At least one body element must separate transitions; adjacent transitions are not allowed.
186
<system_message level="3" line="5" source="test data" type="ERROR">
188
Document may not end with a transition.
191
A paragraph, two transitions, and a blank line.
199
<document source="test data">
201
A paragraph, two transitions, and a blank line.
203
<system_message level="3" line="5" source="test data" type="ERROR">
205
At least one body element must separate transitions; adjacent transitions are not allowed.
207
<system_message level="3" line="5" source="test data" type="ERROR">
209
Document may not end with a transition.
214
Document beginning with a transition.
217
<document source="test data">
218
<system_message level="3" line="1" source="test data" type="ERROR">
220
Document or section may not begin with a transition.
223
Document beginning with a transition.
241
<document source="test data">
242
<section ids="section-1" names="section\ 1">
245
<system_message level="3" line="4" source="test data" type="ERROR">
247
Document or section may not begin with a transition.
249
<system_message level="3" line="6" source="test data" type="ERROR">
251
At least one body element must separate transitions; adjacent transitions are not allowed.
253
<system_message level="3" line="8" source="test data" type="ERROR">
255
At least one body element must separate transitions; adjacent transitions are not allowed.
257
<section ids="section-2" names="section\ 2">
271
<document source="test data">
272
<system_message level="3" line="1" source="test data" type="ERROR">
274
Document or section may not begin with a transition.
276
<system_message level="3" line="3" source="test data" type="ERROR">
278
At least one body element must separate transitions; adjacent transitions are not allowed.
280
<system_message level="3" line="5" source="test data" type="ERROR">
282
At least one body element must separate transitions; adjacent transitions are not allowed.
284
<system_message level="3" line="5" source="test data" type="ERROR">
286
Document may not end with a transition.
295
<document source="test data">
299
<system_message level="3" line="3" source="test data" type="ERROR">
301
Document may not end with a transition.
306
if __name__ == '__main__':
308
unittest.main(defaultTest='suite')