4 # Author: David Goodger <goodger@python.org>
5 # Copyright: This module has been placed in the public domain.
8 Tests for transitions (`thematic breaks`).
10 from __future__
import absolute_import
12 if __name__
== '__main__':
14 from test_parsers
import DocutilsTestSupport
18 s
= DocutilsTestSupport
.RecommonmarkParserTestSuite()
19 s
.generateTests(totest
)
24 # See DocutilsTestSupport.RecommonmarkParserTestSuite.generateTests for a
25 # description of the 'totest' data structure.
26 totest
['transitions'] = [
28 Test transition markers.
35 <document source="test data">
37 Test transition markers.
45 First text division of section 1.
49 Second text division of section 1.
53 Paragraph 2 in section 2.
56 <document source="test data">
57 <section ids="section-1" names="section\\ 1">
61 First text division of section 1.
64 Second text division of section 1.
65 <section ids="section-2" names="section\\ 2">
69 Paragraph 2 in section 2.
74 # A section or document may not begin with a transition.
76 # The DTD specifies that two transitions may not
85 # The DTD also specifies that a section or document
86 # may not end with a transition.
91 # <document source="test data">
94 # A section or document may not begin with a transition.
96 # The DTD specifies that two transitions may not
102 # The DTD also specifies that a section or document
103 # may not end with a transition.
106 # TODO: should we allow transitions in block elements?
107 # +1 Other document formats allow this (HTML, markdown, LaTeX)
108 # and a quoted text may contain a transition.
109 # -1 Requires changing the document model.
111 # Test unexpected transition markers.
120 # <document source="test data">
122 # Test unexpected transition markers.
131 Short transition marker.
135 Too short transition marker.
142 <document source="test data">
144 Short transition marker.
147 Too short transition marker.
154 Sections with transitions at beginning and end.
161 The next transition is legal:
171 <document source="test data">
173 Sections with transitions at beginning and end.
174 <section ids="section-1" names="section\\ 1">
179 The next transition is legal:
181 <section ids="section-2" names="section\\ 2">
187 A paragraph, two transitions, and a blank line.
195 <document source="test data">
197 A paragraph, two transitions, and a blank line.
202 A paragraph and two transitions.
209 <document source="test data">
211 A paragraph and two transitions.
218 Document beginning with a transition.
221 <document source="test data">
224 Document beginning with a transition.
243 <document source="test data">
244 <section ids="section-1" names="section\\ 1">
247 <section ids="subsection-1" names="subsection\\ 1">
253 <section ids="section-2" names="section\\ 2">
275 <document source="test data">
276 <section ids="section-1" names="section\\ 1">
282 <section ids="section-2" names="section\\ 2">
296 <document source="test data">
308 <document source="test data">
316 if __name__
== '__main__':
318 unittest
.main(defaultTest
='suite')