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

« back to all changes in this revision

Viewing changes to test/test_rst/test_transitions.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.2 $
7
 
:Date: $Date: 2002/04/25 03:46:23 $
8
 
:Copyright: This module has been placed in the public domain.
9
 
 
10
 
Tests for transition markers.
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
 
# See DocutilsTestSupport.ParserTestSuite.generateTests for a
23
 
# description of the 'totest' data structure.
24
 
totest['transitions'] = [
25
 
["""\
26
 
Test transition markers.
27
 
 
28
 
--------
29
 
 
30
 
Paragraph
31
 
""",
32
 
"""\
33
 
<document>
34
 
    <paragraph>
35
 
        Test transition markers.
36
 
    <transition>
37
 
    <paragraph>
38
 
        Paragraph
39
 
"""],
40
 
["""\
41
 
Section 1
42
 
=========
43
 
First text division of section 1.
44
 
 
45
 
--------
46
 
 
47
 
Second text division of section 1.
48
 
 
49
 
Section 2
50
 
---------
51
 
Paragraph 2 in section 2.
52
 
""",
53
 
"""\
54
 
<document>
55
 
    <section id="section-1" name="section 1">
56
 
        <title>
57
 
            Section 1
58
 
        <paragraph>
59
 
            First text division of section 1.
60
 
        <transition>
61
 
        <paragraph>
62
 
            Second text division of section 1.
63
 
        <section id="section-2" name="section 2">
64
 
            <title>
65
 
                Section 2
66
 
            <paragraph>
67
 
                Paragraph 2 in section 2.
68
 
"""],
69
 
["""\
70
 
--------
71
 
 
72
 
A section or document may not begin with a transition.
73
 
 
74
 
The DTD specifies that two transitions may not
75
 
be adjacent:
76
 
 
77
 
--------
78
 
 
79
 
--------
80
 
 
81
 
--------
82
 
 
83
 
The DTD also specifies that a section or document
84
 
may not end with a transition.
85
 
 
86
 
--------
87
 
""",
88
 
"""\
89
 
<document>
90
 
    <system_message level="3" type="ERROR">
91
 
        <paragraph>
92
 
            Document or section may not begin with a transition (line 1).
93
 
    <transition>
94
 
    <paragraph>
95
 
        A section or document may not begin with a transition.
96
 
    <paragraph>
97
 
        The DTD specifies that two transitions may not
98
 
        be adjacent:
99
 
    <transition>
100
 
    <system_message level="3" type="ERROR">
101
 
        <paragraph>
102
 
            At least one body element must separate transitions; adjacent transitions at line 10.
103
 
    <transition>
104
 
    <system_message level="3" type="ERROR">
105
 
        <paragraph>
106
 
            At least one body element must separate transitions; adjacent transitions at line 12.
107
 
    <transition>
108
 
    <paragraph>
109
 
        The DTD also specifies that a section or document
110
 
        may not end with a transition.
111
 
    <transition>
112
 
    <system_message level="3" type="ERROR">
113
 
        <paragraph>
114
 
            Document or section may not end with a transition (line 17).
115
 
"""],
116
 
["""\
117
 
Test unexpected transition markers.
118
 
 
119
 
    Block quote.
120
 
 
121
 
    --------
122
 
 
123
 
    Paragraph.
124
 
""",
125
 
"""\
126
 
<document>
127
 
    <paragraph>
128
 
        Test unexpected transition markers.
129
 
    <block_quote>
130
 
        <paragraph>
131
 
            Block quote.
132
 
        <system_message level="4" type="SEVERE">
133
 
            <paragraph>
134
 
                Unexpected section title or transition at line 5.
135
 
            <literal_block>
136
 
                --------
137
 
        <paragraph>
138
 
            Paragraph.
139
 
"""],
140
 
]
141
 
 
142
 
if __name__ == '__main__':
143
 
    import unittest
144
 
    unittest.main(defaultTest='suite')