Spelling fixes
[docutils.git] / test / test_parsers / test_rst / test_citations.py
blob09f7cef816b0058762e0c0cd2f509fd4eef09c9c
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['citations'] = [
21 ["""\
22 .. [citation] This is a citation.
23 """,
24 """\
25 <document source="test data">
26 <citation ids="citation" names="citation">
27 <label>
28 citation
29 <paragraph>
30 This is a citation.
31 """],
32 ["""\
33 .. [citation1234] This is a citation with year.
34 """,
35 """\
36 <document source="test data">
37 <citation ids="citation1234" names="citation1234">
38 <label>
39 citation1234
40 <paragraph>
41 This is a citation with year.
42 """],
43 ["""\
44 .. [citation] This is a citation
45 on multiple lines.
46 """,
47 """\
48 <document source="test data">
49 <citation ids="citation" names="citation">
50 <label>
51 citation
52 <paragraph>
53 This is a citation
54 on multiple lines.
55 """],
56 ["""\
57 .. [citation1] This is a citation
58 on multiple lines with more space.
60 .. [citation2] This is a citation
61 on multiple lines with less space.
62 """,
63 """\
64 <document source="test data">
65 <citation ids="citation1" names="citation1">
66 <label>
67 citation1
68 <paragraph>
69 This is a citation
70 on multiple lines with more space.
71 <citation ids="citation2" names="citation2">
72 <label>
73 citation2
74 <paragraph>
75 This is a citation
76 on multiple lines with less space.
77 """],
78 ["""\
79 .. [citation]
80 This is a citation on multiple lines
81 whose block starts on line 2.
82 """,
83 """\
84 <document source="test data">
85 <citation ids="citation" names="citation">
86 <label>
87 citation
88 <paragraph>
89 This is a citation on multiple lines
90 whose block starts on line 2.
91 """],
92 ["""\
93 .. [citation]
95 That was an empty citation.
96 """,
97 """\
98 <document source="test data">
99 <citation ids="citation" names="citation">
100 <label>
101 citation
102 <paragraph>
103 That was an empty citation.
104 """],
105 ["""\
106 .. [citation]
107 No blank line.
108 """,
109 """\
110 <document source="test data">
111 <citation ids="citation" names="citation">
112 <label>
113 citation
114 <system_message level="2" line="2" source="test data" type="WARNING">
115 <paragraph>
116 Explicit markup ends without a blank line; unexpected unindent.
117 <paragraph>
118 No blank line.
119 """],
120 ["""\
121 .. [citation label with spaces] this isn't a citation
123 .. [*citationlabelwithmarkup*] this isn't a citation
124 """,
125 """\
126 <document source="test data">
127 <comment xml:space="preserve">
128 [citation label with spaces] this isn't a citation
129 <comment xml:space="preserve">
130 [*citationlabelwithmarkup*] this isn't a citation
131 """],
132 ["""
133 isolated internals : ``.-_``.
135 .. [citation.withdot] one dot
137 .. [citation-withdot] one hyphen
139 .. [citation_withunderscore] one underscore
141 .. [citation:with:colons] two colons
143 .. [citation+withplus] one plus
144 """,
145 """<document source="test data">
146 <paragraph>
147 isolated internals : \n\
148 <literal>
151 <citation ids="citation-withdot" names="citation.withdot">
152 <label>
153 citation.withdot
154 <paragraph>
155 one dot
156 <citation ids="id1" names="citation-withdot">
157 <label>
158 citation-withdot
159 <paragraph>
160 one hyphen
161 <citation ids="citation-withunderscore" names="citation_withunderscore">
162 <label>
163 citation_withunderscore
164 <paragraph>
165 one underscore
166 <citation ids="citation-with-colons" names="citation:with:colons">
167 <label>
168 citation:with:colons
169 <paragraph>
170 two colons
171 <citation ids="citation-withplus" names="citation+withplus">
172 <label>
173 citation+withplus
174 <paragraph>
175 one plus
176 """],
180 if __name__ == '__main__':
181 import unittest
182 unittest.main(defaultTest='suite')