~ubuntu-branches/ubuntu/dapper/python-docutils/dapper

« back to all changes in this revision

Viewing changes to test/test_pep/test_rfc2822.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2005-12-13 13:47:41 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051213134741-fhuh5tq3n346q1oj
Tags: 0.3.9-0.1ubuntu1
Synchronize with Debian unstable.

Show diffs side-by-side

added added

removed removed

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