Spelling fixes
[docutils.git] / test / test_parsers / test_rst / test_line_blocks.py
blob55366727948418ad6f95850aada714d9f7462d99
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['line_blocks'] = [
21 ["""\
22 | This is a line block.
23 | Line breaks are *preserved*.
25 | This is a second line block.
27 | This is a third.
28 """,
29 """\
30 <document source="test data">
31 <line_block>
32 <line>
33 This is a line block.
34 <line>
35 Line breaks are \n\
36 <emphasis>
37 preserved
39 <line_block>
40 <line>
41 This is a second line block.
42 <line_block>
43 <line>
44 This is a third.
45 """],
46 ["""\
47 | In line blocks,
48 | Initial indentation is *also* preserved.
49 """,
50 """\
51 <document source="test data">
52 <line_block>
53 <line>
54 In line blocks,
55 <line_block>
56 <line>
57 Initial indentation is \n\
58 <emphasis>
59 also
60 preserved.
61 """],
62 ["""\
63 | Individual lines in line blocks
64 *may* wrap, as indicated by the lack of a vertical bar prefix.
65 | These are called "continuation lines".
66 """,
67 """\
68 <document source="test data">
69 <line_block>
70 <line>
71 Individual lines in line blocks
72 <emphasis>
73 may
74 wrap, as indicated by the lack of a vertical bar prefix.
75 <line>
76 These are called "continuation lines".
77 """],
78 ["""\
79 | Inline markup in line blocks may also wrap *to
80 continuation lines*.
81 | But not to following lines.
82 """,
83 """\
84 <document source="test data">
85 <line_block>
86 <line>
87 Inline markup in line blocks may also wrap \n\
88 <emphasis>
90 continuation lines
92 <line>
93 But not to following lines.
94 """],
95 ["""\
96 \\| This is not a line block.
97 The vertical bar is simply part of a paragraph.
98 """,
99 """\
100 <document source="test data">
101 <paragraph>
102 | This is not a line block.
103 The vertical bar is simply part of a paragraph.
104 """],
105 ["""\
106 | This line block is incomplete.
107 There should be a blank line before this paragraph.
108 """,
109 """\
110 <document source="test data">
111 <line_block>
112 <line>
113 This line block is incomplete.
114 <system_message level="2" line="2" source="test data" type="WARNING">
115 <paragraph>
116 Line block ends without a blank line.
117 <paragraph>
118 There should be a blank line before this paragraph.
119 """],
120 ["""\
121 | This line block contains
123 | blank lines.
124 """,
125 """\
126 <document source="test data">
127 <line_block>
128 <line>
129 This line block contains
130 <line>
131 <line>
132 blank lines.
133 """],
134 ["""\
135 | The blank lines in this block
136 | \n\
137 | \n\
138 | have bogus spaces.
139 """,
140 """\
141 <document source="test data">
142 <line_block>
143 <line>
144 The blank lines in this block
145 <line>
146 <line>
147 <line>
148 have bogus spaces.
149 """],
150 ["""\
151 | Initial indentation is also significant and preserved:
153 | Indented 4 spaces
154 | Not indented
155 | Indented 2 spaces
156 | Indented 4 spaces
157 | Only one space
159 | Continuation lines may be indented less
160 than their base lines.
161 """,
162 """\
163 <document source="test data">
164 <line_block>
165 <line>
166 Initial indentation is also significant and preserved:
167 <line>
168 <line_block>
169 <line>
170 Indented 4 spaces
171 <line>
172 Not indented
173 <line_block>
174 <line_block>
175 <line>
176 Indented 2 spaces
177 <line_block>
178 <line>
179 Indented 4 spaces
180 <line>
181 Only one space
182 <line>
183 <line_block>
184 <line>
185 Continuation lines may be indented less
186 than their base lines.
187 """],
188 ["""\
190 | This block begins and ends with blank lines.
192 """,
193 """\
194 <document source="test data">
195 <line_block>
196 <line>
197 <line>
198 This block begins and ends with blank lines.
199 <line>
200 """],
201 ["""\
202 This is not
203 | a line block.
204 """,
205 """\
206 <document source="test data">
207 <paragraph>
208 This is not
209 | a line block.
210 """],
211 ["""\
212 | The first line is indented.
213 | The second line is more indented.
214 """,
215 """\
216 <document source="test data">
217 <line_block>
218 <line>
219 The first line is indented.
220 <line_block>
221 <line>
222 The second line is more indented.
223 """],
224 ["""\
225 | The first line is indented.
226 | The second line is less indented.
227 """,
228 """\
229 <document source="test data">
230 <line_block>
231 <line_block>
232 <line>
233 The first line is indented.
234 <line>
235 The second line is less indented.
236 """],
237 ["""\
238 |This is not
239 |a line block
241 | This is an
242 |incomplete line block.
243 """,
244 """\
245 <document source="test data">
246 <paragraph>
247 <problematic ids="id2" refid="id1">
249 This is not
250 <problematic ids="id4" refid="id3">
252 a line block
253 <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
254 <paragraph>
255 Inline substitution_reference start-string without end-string.
256 <system_message backrefs="id4" ids="id3" level="2" line="1" source="test data" type="WARNING">
257 <paragraph>
258 Inline substitution_reference start-string without end-string.
259 <line_block>
260 <line>
261 This is an
262 <system_message level="2" line="5" source="test data" type="WARNING">
263 <paragraph>
264 Line block ends without a blank line.
265 <paragraph>
266 <problematic ids="id6" refid="id5">
268 incomplete line block.
269 <system_message backrefs="id6" ids="id5" level="2" line="5" source="test data" type="WARNING">
270 <paragraph>
271 Inline substitution_reference start-string without end-string.
272 """],
273 ["""\
274 | Inline markup *may not
275 | wrap* over several lines.
276 """,
277 """\
278 <document source="test data">
279 <line_block>
280 <line>
281 Inline markup \n\
282 <problematic ids="id2" refid="id1">
284 may not
285 <line>
286 wrap* over several lines.
287 <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
288 <paragraph>
289 Inline emphasis start-string without end-string.
290 """],
291 ["""\
292 | * Block level markup
293 | * is not recognized.
294 """,
295 """\
296 <document source="test data">
297 <line_block>
298 <line>
299 * Block level markup
300 <line>
301 * is not recognized.
302 """],
306 if __name__ == '__main__':
307 import unittest
308 unittest.main(defaultTest='suite')