~ubuntu-branches/ubuntu/karmic/python-docutils/karmic

« back to all changes in this revision

Viewing changes to test/test_writers/test_html4css1/test_parts.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
 
# Author: reggie dugard
4
 
# Contact: reggie@users.sourceforge.net
5
 
# Revision: $Revision: 1.5 $
6
 
# Date: $Date: 2004/05/09 02:38:47 $
7
 
# Copyright: This module has been placed in the public domain.
8
 
 
9
 
"""
10
 
Test for fragment code in HTML writer.
11
 
 
12
 
Note: the 'body' and 'whole' entries have been removed from the parts
13
 
dictionaries (redundant), along with 'meta' and 'stylesheet' entries with
14
 
standard values, and any entries with empty values.
15
 
"""
16
 
 
17
 
from __init__ import DocutilsTestSupport
18
 
 
19
 
def suite():
20
 
    s = DocutilsTestSupport.HtmlPublishPartsTestSuite()
21
 
    s.generateTests(totest)
22
 
    return s
23
 
 
24
 
 
25
 
totest = {}
26
 
 
27
 
totest['Title promotion'] = ({}, [
28
 
["""\
29
 
Simple String
30
 
""",
31
 
"""\
32
 
{'fragment': '''Simple String'''}
33
 
"""
34
 
],
35
 
["""\
36
 
Simple String with *markup*
37
 
""",
38
 
"""\
39
 
{'fragment': '''Simple String with <em>markup</em>'''}
40
 
"""
41
 
],
42
 
["""\
43
 
Simple String with an even simpler ``inline literal``
44
 
""",
45
 
"""\
46
 
{'fragment': '''Simple String with an even simpler <tt class="literal"><span class="pre">inline</span> <span class="pre">literal</span></tt>'''}
47
 
"""
48
 
],
49
 
["""\
50
 
A simple `anonymous reference`__
51
 
 
52
 
__ http://www.test.com/test_url
53
 
""",
54
 
"""\
55
 
{'fragment': '''<p>A simple <a class="reference" href="http://www.test.com/test_url">anonymous reference</a></p>\\n'''}
56
 
"""],
57
 
["""\
58
 
One paragraph.
59
 
 
60
 
Two paragraphs.
61
 
""",
62
 
"""\
63
 
{'fragment': '''<p>One paragraph.</p>
64
 
<p>Two paragraphs.</p>\\n'''}
65
 
"""],
66
 
["""\
67
 
A simple `named reference`_ with stuff in between the
68
 
reference and the target.
69
 
 
70
 
.. _`named reference`: http://www.test.com/test_url
71
 
""",
72
 
"""\
73
 
{'fragment': '''<p>A simple <a class="reference" href="http://www.test.com/test_url">named reference</a> with stuff in between the
74
 
reference and the target.</p>\\n'''}
75
 
"""],
76
 
["""\
77
 
+++++
78
 
Title
79
 
+++++
80
 
 
81
 
Subtitle
82
 
========
83
 
 
84
 
Some stuff
85
 
 
86
 
Section
87
 
-------
88
 
 
89
 
Some more stuff
90
 
 
91
 
Another Section
92
 
...............
93
 
 
94
 
And even more stuff
95
 
""",
96
 
"""\
97
 
{'fragment': '''<p>Some stuff</p>
98
 
<div class="section" id="section">
99
 
<h1><a name="section">Section</a></h1>
100
 
<p>Some more stuff</p>
101
 
<div class="section" id="another-section">
102
 
<h2><a name="another-section">Another Section</a></h2>
103
 
<p>And even more stuff</p>
104
 
</div>
105
 
</div>\\n''',
106
 
 'subtitle': '''Subtitle''',
107
 
 'title': '''Title'''}
108
 
"""],
109
 
["""\
110
 
+++++
111
 
Title
112
 
+++++
113
 
 
114
 
:author: me
115
 
 
116
 
Some stuff
117
 
""",
118
 
"""\
119
 
{'docinfo': '''<table class="docinfo" frame="void" rules="none">
120
 
<col class="docinfo-name" />
121
 
<col class="docinfo-content" />
122
 
<tbody valign="top">
123
 
<tr><th class="docinfo-name">Author:</th>
124
 
<td>me</td></tr>
125
 
</tbody>
126
 
</table>\\n''',
127
 
 'fragment': '''<p>Some stuff</p>\\n''',
128
 
 'meta': '''<meta name="author" content="me" />\\n''',
129
 
 'title': '''Title'''}
130
 
"""]
131
 
])
132
 
 
133
 
totest['No title promotion'] = ({'doctitle_xform' : 0}, [
134
 
["""\
135
 
Simple String
136
 
""",
137
 
"""\
138
 
{'fragment': '''Simple String'''}
139
 
"""
140
 
],
141
 
["""\
142
 
Simple String with *markup*
143
 
""",
144
 
"""\
145
 
{'fragment': '''Simple String with <em>markup</em>'''}
146
 
"""
147
 
],
148
 
["""\
149
 
Simple String with an even simpler ``inline literal``
150
 
""",
151
 
"""\
152
 
{'fragment': '''Simple String with an even simpler <tt class="literal"><span class="pre">inline</span> <span class="pre">literal</span></tt>'''}
153
 
"""
154
 
],
155
 
["""\
156
 
A simple `anonymous reference`__
157
 
 
158
 
__ http://www.test.com/test_url
159
 
""",
160
 
"""\
161
 
{'fragment': '''<p>A simple <a class="reference" href="http://www.test.com/test_url">anonymous reference</a></p>\\n'''}
162
 
"""],
163
 
["""\
164
 
A simple `named reference`_ with stuff in between the
165
 
reference and the target.
166
 
 
167
 
.. _`named reference`: http://www.test.com/test_url
168
 
""",
169
 
"""\
170
 
{'fragment': '''<p>A simple <a class="reference" href="http://www.test.com/test_url">named reference</a> with stuff in between the
171
 
reference and the target.</p>\\n'''}
172
 
"""],
173
 
["""\
174
 
+++++
175
 
Title
176
 
+++++
177
 
 
178
 
Not A Subtitle
179
 
==============
180
 
 
181
 
Some stuff
182
 
 
183
 
Section
184
 
-------
185
 
 
186
 
Some more stuff
187
 
 
188
 
Another Section
189
 
...............
190
 
 
191
 
And even more stuff
192
 
""",
193
 
"""\
194
 
{'fragment': '''<div class="section" id="title">
195
 
<h1><a name="title">Title</a></h1>
196
 
<div class="section" id="not-a-subtitle">
197
 
<h2><a name="not-a-subtitle">Not A Subtitle</a></h2>
198
 
<p>Some stuff</p>
199
 
<div class="section" id="section">
200
 
<h3><a name="section">Section</a></h3>
201
 
<p>Some more stuff</p>
202
 
<div class="section" id="another-section">
203
 
<h4><a name="another-section">Another Section</a></h4>
204
 
<p>And even more stuff</p>
205
 
</div>
206
 
</div>
207
 
</div>
208
 
</div>\\n'''}
209
 
"""]
210
 
])
211
 
 
212
 
 
213
 
if __name__ == '__main__':
214
 
    import unittest
215
 
    unittest.main(defaultTest='suite')