5
:Contact: goodger@users.sourceforge.net
6
:Revision: $Revision: 1.3 $
7
:Date: $Date: 2002/04/25 03:43:53 $
8
:Copyright: This module has been placed in the public domain.
13
from __init__ import DocutilsTestSupport
16
s = DocutilsTestSupport.ParserTestSuite()
17
s.generateTests(totest)
22
totest['substitution_definitions'] = [
24
Here's an image substitution definition:
26
.. |symbol| image:: symbol.png
31
Here's an image substitution definition:
32
<substitution_definition name="symbol">
33
<image alt="symbol" uri="symbol.png">
36
Embedded directive starts on the next line:
44
Embedded directive starts on the next line:
45
<substitution_definition name="symbol">
46
<image alt="symbol" uri="symbol.png">
49
Here's a series of substitution definitions:
51
.. |symbol 1| image:: symbol1.png
52
.. |SYMBOL 2| image:: symbol2.png
55
.. |symbol 3| image:: symbol3.png
60
Here's a series of substitution definitions:
61
<substitution_definition name="symbol 1">
62
<image alt="symbol 1" uri="symbol1.png">
63
<substitution_definition name="symbol 2">
64
<image alt="SYMBOL 2" height="50" uri="symbol2.png" width="100">
65
<substitution_definition name="symbol 3">
66
<image alt="symbol 3" uri="symbol3.png">
69
.. |very long substitution text,
70
split across lines| image:: symbol.png
74
<substitution_definition name="very long substitution text, split across lines">
75
<image alt="very long substitution text, split across lines" uri="symbol.png">
78
.. |symbol 1| image:: symbol.png
80
Followed by a paragraph.
82
.. |symbol 2| image:: symbol.png
84
Followed by a block quote.
88
<substitution_definition name="symbol 1">
89
<image alt="symbol 1" uri="symbol.png">
91
Followed by a paragraph.
92
<substitution_definition name="symbol 2">
93
<image alt="symbol 2" uri="symbol.png">
96
Followed by a block quote.
99
Here are some duplicate substitution definitions:
101
.. |symbol| image:: symbol.png
102
.. |symbol| image:: symbol.png
107
Here are some duplicate substitution definitions:
108
<substitution_definition dupname="symbol">
109
<image alt="symbol" uri="symbol.png">
110
<system_message level="3" type="ERROR">
112
Duplicate substitution definition name: "symbol".
113
<substitution_definition name="symbol">
114
<image alt="symbol" uri="symbol.png">
117
Here are some bad cases:
119
.. |symbol| image:: symbol.png
124
.. |unknown| directive:: symbol.png
126
.. |invalid 1| there's no directive here
127
.. |invalid 2| there's no directive here
128
With some block quote text, line 1.
129
And some more, line 2.
131
.. |invalid 3| there's no directive here
133
.. | bad name | bad data
138
Here are some bad cases:
139
<substitution_definition name="symbol">
140
<image alt="symbol" uri="symbol.png">
141
<system_message level="2" type="WARNING">
143
Explicit markup ends without a blank line; unexpected unindent at line 4.
146
<system_message level="2" type="WARNING">
148
Substitution definition "empty" missing contents at line 6.
151
<system_message level="3" type="ERROR">
153
Unknown directive type "directive" at line 8.
155
directive:: symbol.png
156
<system_message level="2" type="WARNING">
158
Substitution definition "unknown" empty or invalid at line 8.
160
.. |unknown| directive:: symbol.png
161
<system_message level="2" type="WARNING">
163
Substitution definition "invalid 1" empty or invalid at line 10.
165
.. |invalid 1| there's no directive here
166
<system_message level="2" type="WARNING">
168
Substitution definition "invalid 2" empty or invalid at line 11.
170
.. |invalid 2| there's no directive here
171
With some block quote text, line 1.
172
And some more, line 2.
173
<system_message level="2" type="WARNING">
175
Explicit markup ends without a blank line; unexpected unindent at line 12.
178
With some block quote text, line 1.
179
And some more, line 2.
180
<system_message level="2" type="WARNING">
182
Substitution definition "invalid 3" empty or invalid at line 15.
184
.. |invalid 3| there's no directive here
186
| bad name | bad data
190
if __name__ == '__main__':
192
unittest.main(defaultTest='suite')