4 # Author: David Goodger <goodger@python.org>
5 # Copyright: This module has been placed in the public domain.
8 Tests for docutils.transforms.frontmatter.DocInfo.
11 from __init__
import DocutilsTestSupport
12 from docutils
.transforms
.frontmatter
import DocInfo
13 from docutils
.parsers
.rst
import Parser
18 s
= DocutilsTestSupport
.TransformTestSuite(parser
)
19 s
.generateTests(totest
)
24 totest
['bibliographic_field_lists'] = ((DocInfo
,), [
26 .. Bibliographic element extraction.
29 There can only be one abstract.
31 It is automatically moved to the end of the other bibliographic elements.
39 <document source="test data">
53 <topic classes="abstract">
57 There can only be one abstract.
59 It is automatically moved to the end of the other bibliographic elements.
60 <comment xml:space="preserve">
61 Bibliographic element extraction.
64 .. Bibliographic element extraction.
66 :Abstract: Abstract 1.
68 :Address: 123 My Street
72 :Abstract: Abstract 2 (should generate a warning).
77 <document source="test data">
81 <address xml:space="preserve">
85 <reference refuri="mailto:me@my.org">
94 Abstract 2 (should generate a warning).
95 <system_message level="2" line="9" source="test data" type="WARNING">
97 There can only be one "Abstract" field.
106 <topic classes="abstract">
111 <comment xml:space="preserve">
112 Bibliographic element extraction.
115 :Author: - must be a paragraph
116 :Status: a *simple* paragraph
122 .. and not empty either
125 <document source="test data">
131 <bullet_list bullet="-">
135 <system_message level="2" line="1" source="test data" type="WARNING">
137 Cannot extract bibliographic field "Author" containing anything other than a single paragraph.
151 <system_message level="2" line="3" source="test data" type="WARNING">
153 Cannot extract compound bibliographic field "Date".
158 <system_message level="2" line="6" source="test data" type="WARNING">
160 Cannot extract empty bibliographic field "Version".
161 <comment xml:space="preserve">
165 :Authors: Me, Myself, **I**
166 :Authors: PacMan; Ms. PacMan; PacMan, Jr.
178 <document source="test data">
215 <document source="test data">
245 <document source="test data">
251 <system_message level="2" line="1" source="test data" type="WARNING">
253 Cannot extract empty bibliographic field "Authors".
258 <enumerated_list enumtype="arabic" prefix="" suffix=".">
265 <system_message level="2" line="3" source="test data" type="WARNING">
267 Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item.
272 <bullet_list bullet="-">
275 <system_message level="2" line="6" source="test data" type="WARNING">
277 Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item.
282 <bullet_list bullet="-">
288 <system_message level="2" line="10" source="test data" type="WARNING">
290 Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item.
295 <bullet_list bullet="-">
301 <system_message level="2" line="15" source="test data" type="WARNING">
303 Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item.
306 .. RCS keyword extraction.
308 :Status: (some text) $""" + """RCSfile: test_docinfo.py,v $ (more text)
309 :Date: (some text) $""" + """Date: 2002/10/08 01:34:23 $ (more text)
310 :Date: (some text) $""" + """Date: 2005-03-26T16:21:28.693201Z $ (more text)
311 :Version: (some text) $""" + """Revision: 1.1 $ (more text)
314 <document source="test data">
317 (some text) test_docinfo.py (more text)
319 (some text) 2002-10-08 (more text)
321 (some text) 2005-03-26 (more text)
323 (some text) 1.1 (more text)
324 <comment xml:space="preserve">
325 RCS keyword extraction.
330 if __name__
== '__main__':
332 unittest
.main(defaultTest
='suite')