Add support for Markdown.
[docutils.git] / docutils / test / test_parsers / test_rst / test_bullet_lists.py
blobe8bf7a4a996c58abda14dcea320444a4481efaef
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 """
10 from __future__ import absolute_import
12 if __name__ == '__main__':
13 import __init__
14 from test_parsers import DocutilsTestSupport
16 def suite():
17 s = DocutilsTestSupport.ParserTestSuite()
18 s.generateTests(totest)
19 return s
21 totest = {}
23 totest['bullet_lists'] = [
24 ["""\
25 - item
26 """,
27 """\
28 <document source="test data">
29 <bullet_list bullet="-">
30 <list_item>
31 <paragraph>
32 item
33 """],
34 ["""\
35 * item 1
37 * item 2
38 """,
39 """\
40 <document source="test data">
41 <bullet_list bullet="*">
42 <list_item>
43 <paragraph>
44 item 1
45 <list_item>
46 <paragraph>
47 item 2
48 """],
49 ["""\
50 No blank line between:
52 + item 1
53 + item 2
54 """,
55 """\
56 <document source="test data">
57 <paragraph>
58 No blank line between:
59 <bullet_list bullet="+">
60 <list_item>
61 <paragraph>
62 item 1
63 <list_item>
64 <paragraph>
65 item 2
66 """],
67 ["""\
68 - item 1, para 1.
70 item 1, para 2.
72 - item 2
73 """,
74 """\
75 <document source="test data">
76 <bullet_list bullet="-">
77 <list_item>
78 <paragraph>
79 item 1, para 1.
80 <paragraph>
81 item 1, para 2.
82 <list_item>
83 <paragraph>
84 item 2
85 """],
86 ["""\
87 - item 1, line 1
88 item 1, line 2
89 - item 2
90 """,
91 """\
92 <document source="test data">
93 <bullet_list bullet="-">
94 <list_item>
95 <paragraph>
96 item 1, line 1
97 item 1, line 2
98 <list_item>
99 <paragraph>
100 item 2
101 """],
102 ["""\
103 Different bullets:
105 - item 1
107 + item 1
109 * item 1
110 - item 1
111 """,
112 """\
113 <document source="test data">
114 <paragraph>
115 Different bullets:
116 <bullet_list bullet="-">
117 <list_item>
118 <paragraph>
119 item 1
120 <bullet_list bullet="+">
121 <list_item>
122 <paragraph>
123 item 1
124 <bullet_list bullet="*">
125 <list_item>
126 <paragraph>
127 item 1
128 <system_message level="2" line="8" source="test data" type="WARNING">
129 <paragraph>
130 Bullet list ends without a blank line; unexpected unindent.
131 <bullet_list bullet="-">
132 <list_item>
133 <paragraph>
134 item 1
135 """],
136 ["""\
137 - item
138 no blank line
139 """,
140 """\
141 <document source="test data">
142 <bullet_list bullet="-">
143 <list_item>
144 <paragraph>
145 item
146 <system_message level="2" line="2" source="test data" type="WARNING">
147 <paragraph>
148 Bullet list ends without a blank line; unexpected unindent.
149 <paragraph>
150 no blank line
151 """],
152 ["""\
155 empty item above
156 """,
157 """\
158 <document source="test data">
159 <bullet_list bullet="-">
160 <list_item>
161 <paragraph>
162 empty item above
163 """],
164 ["""\
166 empty item above, no blank line
167 """,
168 """\
169 <document source="test data">
170 <bullet_list bullet="-">
171 <list_item>
172 <system_message level="2" line="2" source="test data" type="WARNING">
173 <paragraph>
174 Bullet list ends without a blank line; unexpected unindent.
175 <paragraph>
176 empty item above, no blank line
177 """],
178 [u"""\
179 Unicode bullets:
181 \u2022 BULLET
183 \u2023 TRIANGULAR BULLET
185 \u2043 HYPHEN BULLET
186 """,
187 u"""\
188 <document source="test data">
189 <paragraph>
190 Unicode bullets:
191 <bullet_list bullet="\u2022">
192 <list_item>
193 <paragraph>
194 BULLET
195 <bullet_list bullet="\u2023">
196 <list_item>
197 <paragraph>
198 TRIANGULAR BULLET
199 <bullet_list bullet="\u2043">
200 <list_item>
201 <paragraph>
202 HYPHEN BULLET
203 """],
206 if __name__ == '__main__':
207 import unittest
208 unittest.main(defaultTest='suite')