4 # Author: David Goodger <goodger@python.org>
5 # Copyright: This module has been placed in the public domain.
8 Tests for parts.py contents directive.
11 from __init__
import DocutilsTestSupport
14 s
= DocutilsTestSupport
.ParserTestSuite()
15 s
.generateTests(totest
)
20 totest
['contents'] = [
25 <document source="test data">
26 <topic classes="contents" ids="contents" names="contents">
30 .. internal attributes:
31 .transform: docutils.transforms.parts.Contents
35 .. contents:: Table of Contents
38 <document source="test data">
39 <topic classes="contents" ids="table-of-contents" names="table\ of\ contents">
43 .. internal attributes:
44 .transform: docutils.transforms.parts.Contents
52 <document source="test data">
53 <topic classes="contents" ids="table-of-contents" names="table\ of\ contents">
57 .. internal attributes:
58 .transform: docutils.transforms.parts.Contents
67 <document source="test data">
68 <topic classes="contents" ids="table-of-contents" names="table\ of\ contents">
74 .. internal attributes:
75 .transform: docutils.transforms.parts.Contents
79 .. contents:: *Table* of ``Contents``
82 <document source="test data">
83 <topic classes="contents" ids="table-of-contents" names="table\ of\ contents">
91 .. internal attributes:
92 .transform: docutils.transforms.parts.Contents
101 <document source="test data">
102 <topic classes="contents local" ids="contents" names="contents">
104 .. internal attributes:
105 .transform: docutils.transforms.parts.Contents
115 <document source="test data">
116 <system_message level="3" line="1" source="test data" type="ERROR">
118 Error in "contents" directive:
119 invalid option value: (option: "local"; value: 'arg')
120 no argument is allowed; "arg" supplied.
121 <literal_block xml:space="preserve">
126 .. contents:: Table of Contents
132 <document source="test data">
133 <topic classes="contents local" ids="table-of-contents" names="table\ of\ contents">
137 .. internal attributes:
138 .transform: docutils.transforms.parts.Contents
149 <document source="test data">
150 <system_message level="3" line="1" source="test data" type="ERROR">
152 Error in "contents" directive:
153 invalid option value: (option: "depth"; value: 'two')
155 <literal_block xml:space="preserve">
158 """ % DocutilsTestSupport
.exception_data(int, "two")[1][0]],
164 <document source="test data">
165 <system_message level="3" line="1" source="test data" type="ERROR">
167 Error in "contents" directive:
168 unknown option: "width".
169 <literal_block xml:space="preserve">
178 <document source="test data">
179 <system_message level="3" line="1" source="test data" type="ERROR">
181 Error in "contents" directive:
182 invalid option value: (option: "backlinks"; value: 'no way!')
183 "no way!" unknown; choose from "top", "entry", or "none".
184 <literal_block xml:space="preserve">
193 <document source="test data">
194 <system_message level="3" line="1" source="test data" type="ERROR">
196 Error in "contents" directive:
197 invalid option value: (option: "backlinks"; value: None)
198 must supply an argument; choose from "top", "entry", or "none".
199 <literal_block xml:space="preserve">
207 <document source="test data">
208 <bullet_list bullet="*">
210 <system_message level="3" line="1" source="test data" type="ERROR">
212 The "contents" directive may not be used within topics or body elements.
213 <literal_block xml:space="preserve">
217 .. sidebar:: containing contents
222 <document source="test data">
226 <topic classes="contents" ids="contents" names="contents">
230 .. internal attributes:
231 .transform: docutils.transforms.parts.Contents
237 if __name__
== '__main__':
239 unittest
.main(defaultTest
='suite')