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

« back to all changes in this revision

Viewing changes to test/test_transforms/test_target_notes.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@users.sourceforge.net
 
5
# Revision: $Revision: 4156 $
 
6
# Date: $Date: 2005-12-08 05:43:13 +0100 (Thu, 08 Dec 2005) $
 
7
# Copyright: This module has been placed in the public domain.
 
8
 
 
9
"""
 
10
Tests for `docutils.transforms.references.TargetNotes` (via
 
11
`docutils.transforms.universal.LastReaderPending`).
 
12
"""
 
13
 
 
14
from __init__ import DocutilsTestSupport
 
15
from docutils.transforms.references import PropagateTargets, \
 
16
     AnonymousHyperlinks, IndirectHyperlinks, ExternalTargets, \
 
17
     InternalTargets, DanglingReferences, Footnotes
 
18
from docutils.parsers.rst import Parser
 
19
 
 
20
 
 
21
def suite():
 
22
    parser = Parser()
 
23
    s = DocutilsTestSupport.TransformTestSuite(parser)
 
24
    s.generateTests(totest)
 
25
    return s
 
26
 
 
27
totest = {}
 
28
 
 
29
totest['tables_of_contents'] = ((PropagateTargets, AnonymousHyperlinks,
 
30
                                 IndirectHyperlinks,
 
31
                                 ExternalTargets, InternalTargets,
 
32
                                 DanglingReferences,
 
33
    ), [
 
34
["""\
 
35
.. _target: http://exammple.org
 
36
 
 
37
A reference to a target_.
 
38
 
 
39
.. target-notes::
 
40
""",
 
41
"""\
 
42
<document source="test data">
 
43
    <target ids="target" names="target" refuri="http://exammple.org">
 
44
    <paragraph>
 
45
        A reference to a \n\
 
46
        <reference name="target" refuri="http://exammple.org">
 
47
            target
 
48
         \n\
 
49
        <footnote_reference auto="1" ids="id2" refid="id1">
 
50
        .
 
51
    <footnote auto="1" ids="id1" names="TARGET_NOTE:\\ id1">
 
52
        <paragraph>
 
53
            <reference refuri="http://exammple.org">
 
54
                http://exammple.org
 
55
"""],
 
56
["""\
 
57
.. _target: http://exammple.org
 
58
 
 
59
A reference to a target_.
 
60
 
 
61
.. target-notes:: :class: custom
 
62
""",
 
63
"""\
 
64
<document source="test data">
 
65
    <target ids="target" names="target" refuri="http://exammple.org">
 
66
    <paragraph>
 
67
        A reference to a \n\
 
68
        <reference name="target" refuri="http://exammple.org">
 
69
            target
 
70
        <inline classes="custom">
 
71
             \n\
 
72
        <footnote_reference auto="1" classes="custom" ids="id2" refid="id1">
 
73
        .
 
74
    <footnote auto="1" ids="id1" names="TARGET_NOTE:\\ id1">
 
75
        <paragraph>
 
76
            <reference refuri="http://exammple.org">
 
77
                http://exammple.org
 
78
"""],
 
79
])
 
80
 
 
81
 
 
82
if __name__ == '__main__':
 
83
    import unittest
 
84
    unittest.main(defaultTest='suite')