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

« back to all changes in this revision

Viewing changes to test/test_parsers/test_rst/test_directives/test_decorations.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: David Goodger
 
4
# Contact: goodger@python.org
 
5
# Revision: $Revision: 3184 $
 
6
# Date: $Date: 2005-04-07 21:36:11 +0200 (Thu, 07 Apr 2005) $
 
7
# Copyright: This module has been placed in the public domain.
 
8
 
 
9
"""
 
10
Tests for the "header" & "footer" 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['headers'] = [
 
23
["""\
 
24
.. header:: a paragraph for the header
 
25
""",
 
26
"""\
 
27
<document source="test data">
 
28
    <decoration>
 
29
        <header>
 
30
            <paragraph>
 
31
                a paragraph for the header
 
32
"""],
 
33
["""\
 
34
.. header::
 
35
""",
 
36
"""\
 
37
<document source="test data">
 
38
    <decoration>
 
39
        <header>
 
40
            <paragraph>
 
41
                Problem with the "header" directive: no content supplied.
 
42
    <system_message level="2" line="1" source="test data" type="WARNING">
 
43
        <paragraph>
 
44
            Content block expected for the "header" directive; none found.
 
45
        <literal_block xml:space="preserve">
 
46
            .. header::
 
47
"""],
 
48
["""\
 
49
.. header:: first part of the header
 
50
.. header:: second part of the header
 
51
""",
 
52
"""\
 
53
<document source="test data">
 
54
    <decoration>
 
55
        <header>
 
56
            <paragraph>
 
57
                first part of the header
 
58
            <paragraph>
 
59
                second part of the header
 
60
"""],
 
61
]
 
62
 
 
63
totest['footers'] = [
 
64
["""\
 
65
.. footer:: a paragraph for the footer
 
66
""",
 
67
"""\
 
68
<document source="test data">
 
69
    <decoration>
 
70
        <footer>
 
71
            <paragraph>
 
72
                a paragraph for the footer
 
73
"""],
 
74
["""\
 
75
.. footer:: even if a footer is declared first
 
76
.. header:: the header appears first
 
77
""",
 
78
"""\
 
79
<document source="test data">
 
80
    <decoration>
 
81
        <header>
 
82
            <paragraph>
 
83
                the header appears first
 
84
        <footer>
 
85
            <paragraph>
 
86
                even if a footer is declared first
 
87
"""],
 
88
]
 
89
 
 
90
 
 
91
if __name__ == '__main__':
 
92
    import unittest
 
93
    unittest.main(defaultTest='suite')