~ubuntu-branches/ubuntu/jaunty/python-docutils/jaunty

« back to all changes in this revision

Viewing changes to test/test_rst/test_directives/test_meta.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.3 $
7
 
:Date: $Date: 2002/05/05 15:48:42 $
8
 
:Copyright: This module has been placed in the public domain.
9
 
 
10
 
Tests for html.py meta directives.
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['meta'] = [
23
 
["""\
24
 
.. meta::
25
 
   :description: The reStructuredText plaintext markup language
26
 
   :keywords: plaintext,markup language
27
 
""",
28
 
"""\
29
 
<document>
30
 
    <pending>
31
 
        .. internal attributes:
32
 
             .transform: docutils.transforms.components.Filter
33
 
             .stage: 'first writer'
34
 
             .details:
35
 
               nodes:
36
 
                 <meta content="The reStructuredText plaintext markup language" name="description">
37
 
               writer: 'html'
38
 
    <pending>
39
 
        .. internal attributes:
40
 
             .transform: docutils.transforms.components.Filter
41
 
             .stage: 'first writer'
42
 
             .details:
43
 
               nodes:
44
 
                 <meta content="plaintext,markup language" name="keywords">
45
 
               writer: 'html'
46
 
"""],
47
 
["""\
48
 
.. meta::
49
 
   :description lang=en: An amusing story
50
 
   :description lang=fr: Un histoire amusant
51
 
""",
52
 
"""\
53
 
<document>
54
 
    <pending>
55
 
        .. internal attributes:
56
 
             .transform: docutils.transforms.components.Filter
57
 
             .stage: 'first writer'
58
 
             .details:
59
 
               nodes:
60
 
                 <meta content="An amusing story" lang="en" name="description">
61
 
               writer: 'html'
62
 
    <pending>
63
 
        .. internal attributes:
64
 
             .transform: docutils.transforms.components.Filter
65
 
             .stage: 'first writer'
66
 
             .details:
67
 
               nodes:
68
 
                 <meta content="Un histoire amusant" lang="fr" name="description">
69
 
               writer: 'html'
70
 
"""],
71
 
["""\
72
 
.. meta::
73
 
   :http-equiv=Content-Type: text/html; charset=ISO-8859-1
74
 
""",
75
 
"""\
76
 
<document>
77
 
    <pending>
78
 
        .. internal attributes:
79
 
             .transform: docutils.transforms.components.Filter
80
 
             .stage: 'first writer'
81
 
             .details:
82
 
               nodes:
83
 
                 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
84
 
               writer: 'html'
85
 
"""],
86
 
["""\
87
 
.. meta::
88
 
   :name: content
89
 
     over multiple lines
90
 
""",
91
 
"""\
92
 
<document>
93
 
    <pending>
94
 
        .. internal attributes:
95
 
             .transform: docutils.transforms.components.Filter
96
 
             .stage: 'first writer'
97
 
             .details:
98
 
               nodes:
99
 
                 <meta content="content over multiple lines" name="name">
100
 
               writer: 'html'
101
 
"""],
102
 
["""\
103
 
Paragraph
104
 
 
105
 
.. meta::
106
 
   :name: content
107
 
""",
108
 
"""\
109
 
<document>
110
 
    <paragraph>
111
 
        Paragraph
112
 
    <pending>
113
 
        .. internal attributes:
114
 
             .transform: docutils.transforms.components.Filter
115
 
             .stage: 'first writer'
116
 
             .details:
117
 
               nodes:
118
 
                 <meta content="content" name="name">
119
 
               writer: 'html'
120
 
"""],
121
 
["""\
122
 
.. meta::
123
 
""",
124
 
"""\
125
 
<document>
126
 
    <system_message level="3" type="ERROR">
127
 
        <paragraph>
128
 
            Empty meta directive at line 1.
129
 
"""],
130
 
["""\
131
 
.. meta::
132
 
   :empty:
133
 
""",
134
 
"""\
135
 
<document>
136
 
    <system_message level="1" type="INFO">
137
 
        <paragraph>
138
 
            No content for meta tag "empty" at line 2.
139
 
        <literal_block>
140
 
            :empty:
141
 
"""],
142
 
["""\
143
 
.. meta::
144
 
   not a field list
145
 
""",
146
 
"""\
147
 
<document>
148
 
    <system_message level="3" type="ERROR">
149
 
        <paragraph>
150
 
            Invalid meta directive at line 2.
151
 
        <literal_block>
152
 
            .. meta::
153
 
               not a field list
154
 
"""],
155
 
["""\
156
 
.. meta::
157
 
   :name: content
158
 
   not a field
159
 
""",
160
 
"""\
161
 
<document>
162
 
    <pending>
163
 
        .. internal attributes:
164
 
             .transform: docutils.transforms.components.Filter
165
 
             .stage: 'first writer'
166
 
             .details:
167
 
               nodes:
168
 
                 <meta content="content" name="name">
169
 
               writer: 'html'
170
 
    <system_message level="3" type="ERROR">
171
 
        <paragraph>
172
 
            Invalid meta directive at line 3.
173
 
        <literal_block>
174
 
            .. meta::
175
 
               :name: content
176
 
               not a field
177
 
"""],
178
 
["""\
179
 
.. meta::
180
 
   :name notattval: content
181
 
""",
182
 
"""\
183
 
<document>
184
 
    <system_message level="3" type="ERROR">
185
 
        <paragraph>
186
 
            Error parsing meta tag attribute "notattval" at line 2: missing "=".
187
 
        <literal_block>
188
 
            :name notattval: content
189
 
"""],
190
 
]
191
 
 
192
 
 
193
 
if __name__ == '__main__':
194
 
    import unittest
195
 
    unittest.main(defaultTest='suite')