~ubuntu-branches/ubuntu/hardy/python-docutils/hardy

« back to all changes in this revision

Viewing changes to test/test_rst/test_comments.py

  • Committer: Bazaar Package Importer
  • Author(s): martin f. krafft
  • Date: 2006-07-10 11:45:05 UTC
  • mfrom: (2.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20060710114505-otkhqcslevewxmz5
Tags: 0.4-3
Added build dependency on python-central (closes: #377580).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env python
2
 
 
3
 
"""
4
 
:Author: David Goodger
5
 
:Contact: goodger@users.sourceforge.net
6
 
:Revision: $Revision: 1.4 $
7
 
:Date: $Date: 2002/05/07 04:23:14 $
8
 
:Copyright: This module has been placed in the public domain.
9
 
 
10
 
Tests for states.py.
11
 
"""
12
 
 
13
 
from __init__ import DocutilsTestSupport
14
 
 
15
 
def suite():
16
 
    s = DocutilsTestSupport.ParserTestSuite()
17
 
    s.generateTests(totest)
18
 
    return s
19
 
 
20
 
totest = {}
21
 
 
22
 
totest['comments'] = [
23
 
["""\
24
 
.. A comment
25
 
 
26
 
Paragraph.
27
 
""",
28
 
"""\
29
 
<document>
30
 
    <comment>
31
 
        A comment
32
 
    <paragraph>
33
 
        Paragraph.
34
 
"""],
35
 
["""\
36
 
.. A comment
37
 
   block.
38
 
 
39
 
Paragraph.
40
 
""",
41
 
"""\
42
 
<document>
43
 
    <comment>
44
 
        A comment
45
 
        block.
46
 
    <paragraph>
47
 
        Paragraph.
48
 
"""],
49
 
["""\
50
 
..
51
 
   A comment consisting of multiple lines
52
 
   starting on the line after the
53
 
   explicit markup start.
54
 
""",
55
 
"""\
56
 
<document>
57
 
    <comment>
58
 
        A comment consisting of multiple lines
59
 
        starting on the line after the
60
 
        explicit markup start.
61
 
"""],
62
 
["""\
63
 
.. A comment.
64
 
.. Another.
65
 
 
66
 
Paragraph.
67
 
""",
68
 
"""\
69
 
<document>
70
 
    <comment>
71
 
        A comment.
72
 
    <comment>
73
 
        Another.
74
 
    <paragraph>
75
 
        Paragraph.
76
 
"""],
77
 
["""\
78
 
.. A comment
79
 
no blank line
80
 
 
81
 
Paragraph.
82
 
""",
83
 
"""\
84
 
<document>
85
 
    <comment>
86
 
        A comment
87
 
    <system_message level="2" type="WARNING">
88
 
        <paragraph>
89
 
            Explicit markup ends without a blank line; unexpected unindent at line 2.
90
 
    <paragraph>
91
 
        no blank line
92
 
    <paragraph>
93
 
        Paragraph.
94
 
"""],
95
 
["""\
96
 
.. A comment.
97
 
.. Another.
98
 
no blank line
99
 
 
100
 
Paragraph.
101
 
""",
102
 
"""\
103
 
<document>
104
 
    <comment>
105
 
        A comment.
106
 
    <comment>
107
 
        Another.
108
 
    <system_message level="2" type="WARNING">
109
 
        <paragraph>
110
 
            Explicit markup ends without a blank line; unexpected unindent at line 3.
111
 
    <paragraph>
112
 
        no blank line
113
 
    <paragraph>
114
 
        Paragraph.
115
 
"""],
116
 
["""\
117
 
.. A comment::
118
 
 
119
 
Paragraph.
120
 
""",
121
 
"""\
122
 
<document>
123
 
    <comment>
124
 
        A comment::
125
 
    <paragraph>
126
 
        Paragraph.
127
 
"""],
128
 
["""\
129
 
.. Next is an empty comment, which serves to end this comment and
130
 
   prevents the following block quote being swallowed up.
131
 
 
132
 
..
133
 
 
134
 
    A block quote.
135
 
""",
136
 
"""\
137
 
<document>
138
 
    <comment>
139
 
        Next is an empty comment, which serves to end this comment and
140
 
        prevents the following block quote being swallowed up.
141
 
    <comment>
142
 
    <block_quote>
143
 
        <paragraph>
144
 
            A block quote.
145
 
"""],
146
 
["""\
147
 
term 1
148
 
  definition 1
149
 
 
150
 
  .. a comment
151
 
 
152
 
term 2
153
 
  definition 2
154
 
""",
155
 
"""\
156
 
<document>
157
 
    <definition_list>
158
 
        <definition_list_item>
159
 
            <term>
160
 
                term 1
161
 
            <definition>
162
 
                <paragraph>
163
 
                    definition 1
164
 
                <comment>
165
 
                    a comment
166
 
        <definition_list_item>
167
 
            <term>
168
 
                term 2
169
 
            <definition>
170
 
                <paragraph>
171
 
                    definition 2
172
 
"""],
173
 
["""\
174
 
term 1
175
 
  definition 1
176
 
 
177
 
.. a comment
178
 
 
179
 
term 2
180
 
  definition 2
181
 
""",
182
 
"""\
183
 
<document>
184
 
    <definition_list>
185
 
        <definition_list_item>
186
 
            <term>
187
 
                term 1
188
 
            <definition>
189
 
                <paragraph>
190
 
                    definition 1
191
 
    <comment>
192
 
        a comment
193
 
    <definition_list>
194
 
        <definition_list_item>
195
 
            <term>
196
 
                term 2
197
 
            <definition>
198
 
                <paragraph>
199
 
                    definition 2
200
 
"""],
201
 
["""\
202
 
+ bullet paragraph 1
203
 
 
204
 
  bullet paragraph 2
205
 
 
206
 
  .. comment between bullet paragraphs 2 and 3
207
 
 
208
 
  bullet paragraph 3
209
 
""",
210
 
"""\
211
 
<document>
212
 
    <bullet_list bullet="+">
213
 
        <list_item>
214
 
            <paragraph>
215
 
                bullet paragraph 1
216
 
            <paragraph>
217
 
                bullet paragraph 2
218
 
            <comment>
219
 
                comment between bullet paragraphs 2 and 3
220
 
            <paragraph>
221
 
                bullet paragraph 3
222
 
"""],
223
 
["""\
224
 
+ bullet paragraph 1
225
 
 
226
 
  .. comment between bullet paragraphs 1 (leader) and 2
227
 
 
228
 
  bullet paragraph 2
229
 
""",
230
 
"""\
231
 
<document>
232
 
    <bullet_list bullet="+">
233
 
        <list_item>
234
 
            <paragraph>
235
 
                bullet paragraph 1
236
 
            <comment>
237
 
                comment between bullet paragraphs 1 (leader) and 2
238
 
            <paragraph>
239
 
                bullet paragraph 2
240
 
"""],
241
 
["""\
242
 
+ bullet
243
 
 
244
 
  .. trailing comment
245
 
""",
246
 
"""\
247
 
<document>
248
 
    <bullet_list bullet="+">
249
 
        <list_item>
250
 
            <paragraph>
251
 
                bullet
252
 
            <comment>
253
 
                trailing comment
254
 
"""],
255
 
]
256
 
 
257
 
if __name__ == '__main__':
258
 
    import unittest
259
 
    unittest.main(defaultTest='suite')