~ubuntu-branches/ubuntu/hardy/python-docutils/hardy

« back to all changes in this revision

Viewing changes to test/test_parsers/test_rst/test_directives/test_default_role.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: 3427 $
 
6
# Date: $Date: 2005-06-04 06:01:58 +0200 (Sat, 04 Jun 2005) $
 
7
# Copyright: This module has been placed in the public domain.
 
8
 
 
9
"""
 
10
Tests for misc.py "default-role" directive.
 
11
"""
 
12
 
 
13
from __init__ import DocutilsTestSupport
 
14
 
 
15
 
 
16
def suite():
 
17
    s = DocutilsTestSupport.ParserTestSuite()
 
18
    s.generateTests(totest)
 
19
    return s
 
20
 
 
21
totest = {}
 
22
 
 
23
totest['default-role'] = [
 
24
["""\
 
25
.. default-role:: subscript
 
26
 
 
27
This is a `subscript`.
 
28
""",
 
29
"""\
 
30
<document source="test data">
 
31
    <paragraph>
 
32
        This is a \n\
 
33
        <subscript>
 
34
            subscript
 
35
        .
 
36
"""],
 
37
["""\
 
38
Must define a custom role before using it.
 
39
 
 
40
.. default-role:: custom
 
41
""",
 
42
"""\
 
43
<document source="test data">
 
44
    <paragraph>
 
45
        Must define a custom role before using it.
 
46
    <system_message level="1" line="3" source="test data" type="INFO">
 
47
        <paragraph>
 
48
            No role entry for "custom" in module "docutils.parsers.rst.languages.en".
 
49
            Trying "custom" as canonical role name.
 
50
    <system_message level="3" line="3" source="test data" type="ERROR">
 
51
        <paragraph>
 
52
            Unknown interpreted text role "custom".
 
53
        <literal_block xml:space="preserve">
 
54
            .. default-role:: custom
 
55
"""],
 
56
["""\
 
57
.. role:: custom
 
58
.. default-role:: custom
 
59
 
 
60
This text uses the `default role`.
 
61
 
 
62
.. default-role::
 
63
 
 
64
Returned the `default role` to its standard default.
 
65
""",
 
66
"""\
 
67
<document source="test data">
 
68
    <paragraph>
 
69
        This text uses the \n\
 
70
        <inline classes="custom">
 
71
            default role
 
72
        .
 
73
    <paragraph>
 
74
        Returned the \n\
 
75
        <title_reference>
 
76
            default role
 
77
         to its standard default.
 
78
"""],
 
79
]
 
80
 
 
81
 
 
82
if __name__ == '__main__':
 
83
    import unittest
 
84
    unittest.main(defaultTest='suite')