summaryrefslogtreecommitdiff
path: root/test/test_transforms
diff options
context:
space:
mode:
authorgoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-10-02 01:06:42 +0000
committergoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-10-02 01:06:42 +0000
commitfa67b65d49e091aec810d2e5e8db5b19fc5be2d5 (patch)
treed06d0ea68467bf817ae49a6594db7e08de8adbc9 /test/test_transforms
parent9e9921fe49c022074aeaa20aff58cfc51828b2c3 (diff)
downloaddocutils-fa67b65d49e091aec810d2e5e8db5b19fc5be2d5.tar.gz
Added ``serial_escape`` function; escapes string values that are elements of a list, for serialization. Modified Docutils-XML writing (``Element._dom_node``) and pseudo-XML writing (``Element.starttag``) to use ``serial_escape``.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3915 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'test/test_transforms')
-rwxr-xr-xtest/test_transforms/test_class.py2
-rwxr-xr-xtest/test_transforms/test_contents.py44
-rwxr-xr-xtest/test_transforms/test_doctitle.py16
-rwxr-xr-xtest/test_transforms/test_hyperlinks.py28
-rwxr-xr-xtest/test_transforms/test_peps.py2
-rwxr-xr-xtest/test_transforms/test_sectnum.py50
-rwxr-xr-xtest/test_transforms/test_substitutions.py2
-rwxr-xr-xtest/test_transforms/test_transitions.py16
8 files changed, 80 insertions, 80 deletions
diff --git a/test/test_transforms/test_class.py b/test/test_transforms/test_class.py
index 601272135..4cd874ea3 100755
--- a/test/test_transforms/test_class.py
+++ b/test/test_transforms/test_class.py
@@ -71,7 +71,7 @@ Paragraph
""",
"""\
<document source="test data">
- <section classes="four" ids="section-title" names="section title">
+ <section classes="four" ids="section-title" names="section\ title">
<title>
Section Title
<paragraph>
diff --git a/test/test_transforms/test_contents.py b/test/test_transforms/test_contents.py
index c96764343..19705b5ba 100755
--- a/test/test_transforms/test_contents.py
+++ b/test/test_transforms/test_contents.py
@@ -70,26 +70,26 @@ Paragraph 4.
<paragraph>
<reference ids="id4" refid="title-4">
Title 4
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title refid="id1">
Title 1
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title>
<reference name="Title" refname="title">
Title
2
<paragraph>
Paragraph 2.
- <section ids="title-3" names="title 3">
+ <section ids="title-3" names="title\ 3">
<title refid="id3">
<target ids="title" names="title">
Title
3
<paragraph>
Paragraph 3.
- <section ids="title-4" names="title 4">
+ <section ids="title-4" names="title\ 4">
<title refid="id4">
Title 4
<paragraph>
@@ -108,7 +108,7 @@ Paragraph 2.
""",
"""\
<document source="test data">
- <topic classes="contents" ids="table-of-contents" names="table of contents">
+ <topic classes="contents" ids="table-of-contents" names="table\ of\ contents">
<title>
Table of Contents
<bullet_list>
@@ -121,12 +121,12 @@ Paragraph 2.
<paragraph>
<reference ids="id2" refid="title-2">
Title 2
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title refid="id1">
Title 1
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title refid="id2">
Title 2
<paragraph>
@@ -147,7 +147,7 @@ Paragraph 2.
""",
"""\
<document source="test data">
- <topic classes="contents" ids="there-s-an-image-in-title-2" names="there's an image in title 2">
+ <topic classes="contents" ids="there-s-an-image-in-title-2" names="there's\ an\ image\ in\ title\ 2">
<title>
There's an image in Title 2
<bullet_list>
@@ -159,17 +159,17 @@ Paragraph 2.
<paragraph>
<reference ids="id2" refid="title-2">
Title 2
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title refid="id1">
Title 1
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title refid="id2">
<image alt="Title 2" uri="title2.png">
<paragraph>
Paragraph 2.
- <substitution_definition names="Title 2">
+ <substitution_definition names="Title\ 2">
<image alt="Title 2" uri="title2.png">
"""], # emacs cruft: "
["""\
@@ -211,22 +211,22 @@ Paragraph 4.
<paragraph>
<reference ids="id3" refid="title-4">
Title 4
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title refid="id1">
Title 1
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title refid="id2">
Title 2
<paragraph>
Paragraph 2.
- <section ids="title-3" names="title 3">
+ <section ids="title-3" names="title\ 3">
<title>
Title 3
<paragraph>
Paragraph 3.
- <section ids="title-4" names="title 4">
+ <section ids="title-4" names="title\ 4">
<title refid="id3">
Title 4
<paragraph>
@@ -255,7 +255,7 @@ Paragraph 4.
""",
"""\
<document source="test data">
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title>
Title 1
<topic classes="contents local" ids="contents" names="contents">
@@ -275,17 +275,17 @@ Paragraph 4.
Title 4
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title refid="id1">
Title 2
<paragraph>
Paragraph 2.
- <section ids="title-3" names="title 3">
+ <section ids="title-3" names="title\ 3">
<title refid="id2">
Title 3
<paragraph>
Paragraph 3.
- <section ids="title-4" names="title 4">
+ <section ids="title-4" names="title\ 4">
<title refid="id3">
Title 4
<paragraph>
@@ -396,7 +396,7 @@ Paragraph 3.
""",
"""\
<document source="test data">
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title>
Title 1
<paragraph>
@@ -415,12 +415,12 @@ Paragraph 3.
<paragraph>
<reference ids="id2" refid="title-3">
Title 3
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title refid="id1">
Title 2
<paragraph>
Paragraph 2.
- <section ids="title-3" names="title 3">
+ <section ids="title-3" names="title\ 3">
<title refid="id2">
Title 3
<paragraph>
diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py
index 22629c45a..3000f53a5 100755
--- a/test/test_transforms/test_doctitle.py
+++ b/test/test_transforms/test_doctitle.py
@@ -120,7 +120,7 @@ The system_message should move after the document title
(it was before the beginning of the section).
""",
"""\
-<document ids="long-title" names="long title" source="test data" title="Long Title">
+<document ids="long-title" names="long\ title" source="test data" title="Long Title">
<title>
Long Title
<system_message level="2" line="1" source="test data" type="WARNING">
@@ -151,19 +151,19 @@ Title 3
Paragraph 3.
""",
"""\
-<document ids="title-1" names="title 1" source="test data" title="Title 1">
+<document ids="title-1" names="title\ 1" source="test data" title="Title 1">
<title>
Title 1
<comment xml:space="preserve">
Test multiple second-level titles.
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title>
Title 2
<paragraph>
Paragraph 2.
- <section ids="title-3" names="title 3">
+ <section ids="title-3" names="title\ 3">
<title>
Title 3
<paragraph>
@@ -185,7 +185,7 @@ substitution_definition.
Title
<substitution_definition names="foo">
bar
- <target ids="invisible-target" names="invisible target">
+ <target ids="invisible-target" names="invisible\ target">
<paragraph>
This title should be the document title despite the
substitution_definition.
@@ -212,15 +212,15 @@ Another Subtitle
<document source="test data">
<paragraph>
(Because of this paragraph, the following is not a doc title.)
- <section ids="section-title" names="section title">
+ <section ids="section-title" names="section\ title">
<title>
Section Title
<subtitle ids="subtitle" names="subtitle">
Subtitle
- <section ids="another-section" names="another section">
+ <section ids="another-section" names="another\ section">
<title>
Another Section
- <subtitle ids="another-subtitle" names="another subtitle">
+ <subtitle ids="another-subtitle" names="another\ subtitle">
Another Subtitle
"""],
])
diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py
index d060043cd..1b84a18c4 100755
--- a/test/test_transforms/test_hyperlinks.py
+++ b/test/test_transforms/test_hyperlinks.py
@@ -291,7 +291,7 @@ Another reference to the same `embedded URI`_.
An \n\
<reference name="embedded uri" refuri="http://direct">
embedded uri
- <target ids="embedded-uri" names="embedded uri" refuri="http://direct">
+ <target ids="embedded-uri" names="embedded\ uri" refuri="http://direct">
.
<paragraph>
Another reference to the same \n\
@@ -357,7 +357,7 @@ By this `internal hyperlink`_ reference.
"""\
<document source="test data">
<target refid="internal-hyperlink">
- <paragraph ids="internal-hyperlink" names="internal hyperlink">
+ <paragraph ids="internal-hyperlink" names="internal\ hyperlink">
This paragraph referenced.
<paragraph>
By this \n\
@@ -380,7 +380,7 @@ The results of the transform are not visible at the XML level.
<document source="test data">
<target refid="chained">
<target refid="internal-hyperlink">
- <paragraph ids="internal-hyperlink chained" names="internal hyperlink chained">
+ <paragraph ids="internal-hyperlink chained" names="internal\ hyperlink chained">
This paragraph referenced.
<paragraph>
By this \n\
@@ -488,7 +488,7 @@ a_\ b_
""",
"""\
<document source="test data">
- <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri">
+ <target ids="external-hyperlink" names="external\ hyperlink" refuri="http://uri">
<paragraph>
<reference name="External hyperlink" refuri="http://uri">
External hyperlink
@@ -500,8 +500,8 @@ a_\ b_
""",
"""\
<document source="test data">
- <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri">
- <target ids="indirect-target" names="indirect target" refuri="http://uri">
+ <target ids="external-hyperlink" names="external\ hyperlink" refuri="http://uri">
+ <target ids="indirect-target" names="indirect\ target" refuri="http://uri">
<system_message level="1" line="2" source="test data" type="INFO">
<paragraph>
Hyperlink target "indirect target" is not referenced.
@@ -516,7 +516,7 @@ and a chained_ reference too.
"""\
<document source="test data">
<target refid="chained">
- <target ids="external-hyperlink chained" names="external hyperlink chained" refuri="http://uri">
+ <target ids="external-hyperlink chained" names="external\ hyperlink chained" refuri="http://uri">
<paragraph>
<reference name="External hyperlink" refuri="http://uri">
External hyperlink
@@ -534,8 +534,8 @@ and a chained_ reference too.
""",
"""\
<document source="test data">
- <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri">
- <target ids="indirect-hyperlink" names="indirect hyperlink" refuri="http://uri">
+ <target ids="external-hyperlink" names="external\ hyperlink" refuri="http://uri">
+ <target ids="indirect-hyperlink" names="indirect\ hyperlink" refuri="http://uri">
<paragraph>
<reference name="Indirect hyperlink" refuri="http://uri">
Indirect hyperlink
@@ -550,9 +550,9 @@ Chained_ `indirect hyperlink`_ reference.
""",
"""\
<document source="test data">
- <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri">
+ <target ids="external-hyperlink" names="external\ hyperlink" refuri="http://uri">
<target refuri="http://uri">
- <target ids="indirect-hyperlink chained" names="indirect hyperlink chained" refuri="http://uri">
+ <target ids="indirect-hyperlink chained" names="indirect\ hyperlink chained" refuri="http://uri">
<paragraph>
<reference name="Chained" refuri="http://uri">
Chained
@@ -700,7 +700,7 @@ Testing an `indirect reference to the table of contents`_.
""",
"""\
<document source="test data">
- <topic classes="contents" ids="table-of-contents" names="table of contents">
+ <topic classes="contents" ids="table-of-contents" names="table\ of\ contents">
<title>
Table of Contents
<bullet_list>
@@ -708,7 +708,7 @@ Testing an `indirect reference to the table of contents`_.
<paragraph>
<reference ids="id1" refid="section">
Section
- <target ids="indirect-reference-to-the-table-of-contents" names="indirect reference to the table of contents" refid="table-of-contents">
+ <target ids="indirect-reference-to-the-table-of-contents" names="indirect\ reference\ to\ the\ table\ of\ contents" refid="table-of-contents">
<section ids="section" names="section">
<title refid="id1">
Section
@@ -729,7 +729,7 @@ Let's reference it (`explicit target`_) to avoid an irrelevant error.
"""\
<document source="test data">
<target refid="explicit-target">
- <section ids="title explicit-target" names="title explicit target">
+ <section ids="title explicit-target" names="title explicit\ target">
<title>
Title
<paragraph>
diff --git a/test/test_transforms/test_peps.py b/test/test_transforms/test_peps.py
index 5ab57be50..5e34aea80 100755
--- a/test/test_transforms/test_peps.py
+++ b/test/test_transforms/test_peps.py
@@ -54,7 +54,7 @@ A "References" section should be generated.
<section ids="id1">
<title>
References
- <footnote auto="1" ids="id2" names="TARGET_NOTE: id2">
+ <footnote auto="1" ids="id2" names="TARGET_NOTE:\ id2">
<paragraph>
<reference refuri="http://www.example.org">
http://www.example.org
diff --git a/test/test_transforms/test_sectnum.py b/test/test_transforms/test_sectnum.py
index 514ae419f..60237cea1 100755
--- a/test/test_transforms/test_sectnum.py
+++ b/test/test_transforms/test_sectnum.py
@@ -46,28 +46,28 @@ Paragraph 4.
""",
u"""\
<document source="test data">
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title auto="1">
<generated classes="sectnum">
1\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title auto="1">
<generated classes="sectnum">
1.1\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section ids="title-3" names="title 3">
+ <section ids="title-3" names="title\ 3">
<title auto="1">
<generated classes="sectnum">
1.1.1\u00a0\u00a0\u00a0
Title 3
<paragraph>
Paragraph 3.
- <section ids="title-4" names="title 4">
+ <section ids="title-4" names="title\ 4">
<title auto="1">
<generated classes="sectnum">
1.2\u00a0\u00a0\u00a0
@@ -84,7 +84,7 @@ Paragraph 1.
""",
u"""\
<document source="test data">
- <section ids="bold-title" names="bold title">
+ <section ids="bold-title" names="bold\ title">
<title auto="1">
<generated classes="sectnum">
1\u00a0\u00a0\u00a0
@@ -114,26 +114,26 @@ Paragraph 4.
""",
u"""\
<document source="test data">
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title auto="1">
<generated classes="sectnum">
1\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title auto="1">
<generated classes="sectnum">
1.1\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section ids="title-3" names="title 3">
+ <section ids="title-3" names="title\ 3">
<title>
Title 3
<paragraph>
Paragraph 3.
- <section ids="title-4" names="title 4">
+ <section ids="title-4" names="title\ 4">
<title auto="1">
<generated classes="sectnum">
1.2\u00a0\u00a0\u00a0
@@ -191,26 +191,26 @@ u"""\
<generated classes="sectnum">
1.2\u00a0\u00a0\u00a0
Title 4
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title auto="1" refid="id1">
<generated classes="sectnum">
1\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title auto="1" refid="id2">
<generated classes="sectnum">
1.1\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section ids="title-3" names="title 3">
+ <section ids="title-3" names="title\ 3">
<title refid="id3">
Title 3
<paragraph>
Paragraph 3.
- <section ids="title-4" names="title 4">
+ <section ids="title-4" names="title\ 4">
<title auto="1" refid="id4">
<generated classes="sectnum">
1.2\u00a0\u00a0\u00a0
@@ -240,28 +240,28 @@ Paragraph 4.
""",
u"""\
<document source="test data">
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title auto="1">
<generated classes="sectnum">
Arbitrary-1\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title auto="1">
<generated classes="sectnum">
Arbitrary-1.1\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section ids="title-3" names="title 3">
+ <section ids="title-3" names="title\ 3">
<title auto="1">
<generated classes="sectnum">
Arbitrary-1.1.1\u00a0\u00a0\u00a0
Title 3
<paragraph>
Paragraph 3.
- <section ids="title-4" names="title 4">
+ <section ids="title-4" names="title\ 4">
<title auto="1">
<generated classes="sectnum">
Arbitrary-1.2\u00a0\u00a0\u00a0
@@ -291,28 +291,28 @@ Paragraph 4.
""",
u"""\
<document source="test data">
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title auto="1">
<generated classes="sectnum">
3\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title auto="1">
<generated classes="sectnum">
3.1\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section ids="title-3" names="title 3">
+ <section ids="title-3" names="title\ 3">
<title auto="1">
<generated classes="sectnum">
3.1.1\u00a0\u00a0\u00a0
Title 3
<paragraph>
Paragraph 3.
- <section ids="title-4" names="title 4">
+ <section ids="title-4" names="title\ 4">
<title auto="1">
<generated classes="sectnum">
3.2\u00a0\u00a0\u00a0
@@ -344,28 +344,28 @@ Paragraph 4.
""",
u"""\
<document source="test data">
- <section ids="title-1" names="title 1">
+ <section ids="title-1" names="title\ 1">
<title auto="1">
<generated classes="sectnum">
(5.9.3)\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section ids="title-2" names="title 2">
+ <section ids="title-2" names="title\ 2">
<title auto="1">
<generated classes="sectnum">
(5.9.3.1)\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section ids="title-3" names="title 3">
+ <section ids="title-3" names="title\ 3">
<title auto="1">
<generated classes="sectnum">
(5.9.3.1.1)\u00a0\u00a0\u00a0
Title 3
<paragraph>
Paragraph 3.
- <section ids="title-4" names="title 4">
+ <section ids="title-4" names="title\ 4">
<title auto="1">
<generated classes="sectnum">
(5.9.3.2)\u00a0\u00a0\u00a0
diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py
index 19534a486..723f01473 100755
--- a/test/test_transforms/test_substitutions.py
+++ b/test/test_transforms/test_substitutions.py
@@ -209,7 +209,7 @@ u"""\
.
<substitution_definition names="copy">
\u00a9
- <substitution_definition names="BogusMegaCorp (TM)">
+ <substitution_definition names="BogusMegaCorp\ (TM)">
BogusMegaCorp
\u2122
"""],
diff --git a/test/test_transforms/test_transitions.py b/test/test_transforms/test_transitions.py
index 24a69bb52..e450ddff7 100755
--- a/test/test_transforms/test_transitions.py
+++ b/test/test_transforms/test_transitions.py
@@ -42,16 +42,16 @@ Some text.
""",
"""\
<document source="test data">
- <section ids="section-1" names="section 1">
+ <section ids="section-1" names="section\ 1">
<title>
Section 1
- <section ids="subsection-1" names="subsection 1">
+ <section ids="subsection-1" names="subsection\ 1">
<title>
Subsection 1
<paragraph>
Some text.
<transition>
- <section ids="section-2" names="section 2">
+ <section ids="section-2" names="section\ 2">
<title>
Section 2
<paragraph>
@@ -72,7 +72,7 @@ Paragraph.
<paragraph>
A paragraph.
<transition>
- <section ids="section-1" names="section 1">
+ <section ids="section-1" names="section\ 1">
<title>
Section 1
<paragraph>
@@ -146,7 +146,7 @@ Section 2
<document source="test data">
<paragraph>
Sections with transitions at beginning and end.
- <section ids="section-1" names="section 1">
+ <section ids="section-1" names="section\ 1">
<title>
Section 1
<system_message level="3" line="6" source="test data" type="ERROR">
@@ -156,7 +156,7 @@ Section 2
<paragraph>
The next transition is legal:
<transition>
- <section ids="section-2" names="section 2">
+ <section ids="section-2" names="section\ 2">
<title>
Section 2
<system_message level="3" line="15" source="test data" type="ERROR">
@@ -239,7 +239,7 @@ Some text.
""",
"""\
<document source="test data">
- <section ids="section-1" names="section 1">
+ <section ids="section-1" names="section\ 1">
<title>
Section 1
<system_message level="3" line="4" source="test data" type="ERROR">
@@ -254,7 +254,7 @@ Some text.
<paragraph>
At least one body element must separate transitions; adjacent transitions are not allowed.
<transition>
- <section ids="section-2" names="section 2">
+ <section ids="section-2" names="section\ 2">
<title>
Section 2
<paragraph>