From 101671ae44e1686680c80cd07b452aabeb88fb63 Mon Sep 17 00:00:00 2001 From: goodger Date: Sat, 20 Apr 2002 03:01:52 +0000 Subject: Initial revision git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@18 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 175 ++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100755 test/test_transforms/test_doctitle.py (limited to 'test/test_transforms/test_doctitle.py') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py new file mode 100755 index 000000000..4ba0d69c5 --- /dev/null +++ b/test/test_transforms/test_doctitle.py @@ -0,0 +1,175 @@ +#! /usr/bin/env python + +""" +:Author: David Goodger +:Contact: goodger@users.sourceforge.net +:Revision: $Revision$ +:Date: $Date$ +:Copyright: This module has been placed in the public domain. + +Tests for docutils.transforms.frontmatter.DocTitle. +""" + +import DocutilsTestSupport +import UnitTestFolder +from docutils.transforms.frontmatter import DocTitle +from docutils.parsers.rst import Parser + + +def suite(): + parser = Parser() + s = DocutilsTestSupport.TransformTestSuite(parser) + s.generateTests(totest) + return s + +totest = {} + +totest['section_headers'] = ((DocTitle,), [ +["""\ +.. test title promotion + +Title +===== + +Paragraph. +""", +"""\ + + + Title + <comment> + test title promotion + <paragraph> + Paragraph. +"""], +["""\ +Title +===== +Paragraph (no blank line). +""", +"""\ +<document id="title" name="title"> + <title> + Title + <paragraph> + Paragraph (no blank line). +"""], +["""\ +Paragraph. + +Title +===== + +Paragraph. +""", +"""\ +<document> + <paragraph> + Paragraph. + <section id="title" name="title"> + <title> + Title + <paragraph> + Paragraph. +"""], +["""\ +Title +===== + +Subtitle +-------- + +Test title & subtitle. +""", +"""\ +<document id="title" name="title"> + <title> + Title + <subtitle id="subtitle" name="subtitle"> + Subtitle + <paragraph> + Test title & subtitle. +"""], +["""\ +Title +==== + +Test short underline. +""", +"""\ +<document id="title" name="title"> + <title> + Title + <system_message level="1" type="INFO"> + <paragraph> + Title underline too short at line 2. + <literal_block> + Title + ==== + <paragraph> + Test short underline. +"""], +["""\ +======= + Long Title +======= + +Test long title and space normalization. +The system_message should move after the document title +(it was before the beginning of the section). +""", +"""\ +<document id="long-title" name="long title"> + <title> + Long Title + <system_message level="1" type="INFO"> + <paragraph> + Title overline too short at line 1. + <literal_block> + ======= + Long Title + ======= + <paragraph> + Test long title and space normalization. + The system_message should move after the document title + (it was before the beginning of the section). +"""], +["""\ +.. Test multiple second-level titles. + +Title 1 +======= +Paragraph 1. + +Title 2 +------- +Paragraph 2. + +Title 3 +------- +Paragraph 3. +""", +"""\ +<document id="title-1" name="title 1"> + <title> + Title 1 + <comment> + Test multiple second-level titles. + <paragraph> + Paragraph 1. + <section id="title-2" name="title 2"> + <title> + Title 2 + <paragraph> + Paragraph 2. + <section id="title-3" name="title 3"> + <title> + Title 3 + <paragraph> + Paragraph 3. +"""], +]) + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From 0ec60c8d82032a385f374ded26617fd076442414 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 25 Apr 2002 03:47:35 +0000 Subject: enabled running standalone git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@47 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test/test_transforms/test_doctitle.py') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 4ba0d69c5..842906945 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -10,8 +10,7 @@ Tests for docutils.transforms.frontmatter.DocTitle. """ -import DocutilsTestSupport -import UnitTestFolder +from __init__ import DocutilsTestSupport from docutils.transforms.frontmatter import DocTitle from docutils.parsers.rst import Parser -- cgit v1.2.1 From a3aaef18e8533f233feb7921e59d42a47a56e424 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 8 Aug 2002 00:32:51 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@487 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/test_transforms/test_doctitle.py') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 842906945..0040e54e6 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -99,7 +99,7 @@ Test short underline. <document id="title" name="title"> <title> Title - <system_message level="1" type="INFO"> + <system_message level="2" type="WARNING"> <paragraph> Title underline too short at line 2. <literal_block> @@ -121,7 +121,7 @@ The system_message should move after the document title <document id="long-title" name="long title"> <title> Long Title - <system_message level="1" type="INFO"> + <system_message level="2" type="WARNING"> <paragraph> Title overline too short at line 1. <literal_block> -- cgit v1.2.1 From 13ed20d392cc6c5e727344dad0c3aca8cea125f1 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 21 Aug 2002 03:00:07 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@572 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'test/test_transforms/test_doctitle.py') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 0040e54e6..a5c71f043 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -33,10 +33,10 @@ Title Paragraph. """, """\ -<document id="title" name="title"> +<document id="title" name="title" source="test data"> <title> Title - <comment> + <comment xml:space="1"> test title promotion <paragraph> Paragraph. @@ -47,7 +47,7 @@ Title Paragraph (no blank line). """, """\ -<document id="title" name="title"> +<document id="title" name="title" source="test data"> <title> Title <paragraph> @@ -62,7 +62,7 @@ Title Paragraph. """, """\ -<document> +<document source="test data"> <paragraph> Paragraph. <section id="title" name="title"> @@ -81,7 +81,7 @@ Subtitle Test title & subtitle. """, """\ -<document id="title" name="title"> +<document id="title" name="title" source="test data"> <title> Title <subtitle id="subtitle" name="subtitle"> @@ -96,13 +96,13 @@ Title Test short underline. """, """\ -<document id="title" name="title"> +<document id="title" name="title" source="test data"> <title> Title - <system_message level="2" type="WARNING"> + <system_message level="2" source="test data" type="WARNING"> <paragraph> Title underline too short at line 2. - <literal_block> + <literal_block xml:space="1"> Title ==== <paragraph> @@ -118,13 +118,13 @@ The system_message should move after the document title (it was before the beginning of the section). """, """\ -<document id="long-title" name="long title"> +<document id="long-title" name="long title" source="test data"> <title> Long Title - <system_message level="2" type="WARNING"> + <system_message level="2" source="test data" type="WARNING"> <paragraph> Title overline too short at line 1. - <literal_block> + <literal_block xml:space="1"> ======= Long Title ======= @@ -149,10 +149,10 @@ Title 3 Paragraph 3. """, """\ -<document id="title-1" name="title 1"> +<document id="title-1" name="title 1" source="test data"> <title> Title 1 - <comment> + <comment xml:space="1"> Test multiple second-level titles. <paragraph> Paragraph 1. -- cgit v1.2.1 From 8a494943a32c912d9929dee8afa19826a2d36410 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 4 Sep 2002 01:41:30 +0000 Subject: Updated for the new "line" attribute of system messages. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@624 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test/test_transforms/test_doctitle.py') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index a5c71f043..83e92810a 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -99,9 +99,9 @@ Test short underline. <document id="title" name="title" source="test data"> <title> Title - <system_message level="2" source="test data" type="WARNING"> + <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> - Title underline too short at line 2. + Title underline too short. <literal_block xml:space="1"> Title ==== @@ -121,9 +121,9 @@ The system_message should move after the document title <document id="long-title" name="long title" source="test data"> <title> Long Title - <system_message level="2" source="test data" type="WARNING"> + <system_message level="2" line="1" source="test data" type="WARNING"> <paragraph> - Title overline too short at line 1. + Title overline too short. <literal_block xml:space="1"> ======= Long Title @@ -169,6 +169,7 @@ Paragraph 3. """], ]) + if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') -- cgit v1.2.1 From 74483521b73dcac8f3d331af5ffa9892808674d8 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 24 Sep 2002 02:15:39 +0000 Subject: Fixed "xml:space" attribute. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@711 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/test_transforms/test_doctitle.py') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 83e92810a..583f79508 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -36,7 +36,7 @@ Paragraph. <document id="title" name="title" source="test data"> <title> Title - <comment xml:space="1"> + <comment xml:space="preserve"> test title promotion <paragraph> Paragraph. @@ -102,7 +102,7 @@ Test short underline. <system_message level="2" line="2" source="test data" type="WARNING"> <paragraph> Title underline too short. - <literal_block xml:space="1"> + <literal_block xml:space="preserve"> Title ==== <paragraph> @@ -124,7 +124,7 @@ The system_message should move after the document title <system_message level="2" line="1" source="test data" type="WARNING"> <paragraph> Title overline too short. - <literal_block xml:space="1"> + <literal_block xml:space="preserve"> ======= Long Title ======= @@ -152,7 +152,7 @@ Paragraph 3. <document id="title-1" name="title 1" source="test data"> <title> Title 1 - <comment xml:space="1"> + <comment xml:space="preserve"> Test multiple second-level titles. <paragraph> Paragraph 1. -- cgit v1.2.1 From 58036bb54a184a823272be8ddf5f52c619d4f83c Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Tue, 8 Oct 2002 01:35:57 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@774 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/test_transforms/test_doctitle.py') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 583f79508..3e08eb232 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -1,12 +1,12 @@ #! /usr/bin/env python -""" -:Author: David Goodger -:Contact: goodger@users.sourceforge.net -:Revision: $Revision$ -:Date: $Date$ -:Copyright: This module has been placed in the public domain. +# Author: David Goodger +# Contact: goodger@users.sourceforge.net +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. +""" Tests for docutils.transforms.frontmatter.DocTitle. """ -- cgit v1.2.1 From fe199e4df644621b7c5ceac3987a558af3321cdf Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sun, 31 Oct 2004 21:35:35 +0000 Subject: added test for substitution_definitions and targets before doctitle git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2790 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/test_transforms/test_doctitle.py') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 3e08eb232..1e6bc1ee0 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -167,6 +167,27 @@ Paragraph 3. <paragraph> Paragraph 3. """], +["""\ +.. |foo| replace:: bar + +.. _invisible target: + +Title +===== +This title should be the document title despite the +substitution_definition. +""", +"""\ +<document id="title" name="title" source="test data"> + <title> + Title + <substitution_definition name="foo"> + bar + <target id="invisible-target" name="invisible target"> + <paragraph> + This title should be the document title despite the + substitution_definition. +"""], ]) -- cgit v1.2.1 From 9dbc2adead008935245a396eab10bb7bcb11b226 Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Sat, 26 Mar 2005 16:21:28 +0000 Subject: merged rev. 3094:3101 and 3102:HEAD from branches/multiple-ids to trunk git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3129 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'test/test_transforms/test_doctitle.py') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 1e6bc1ee0..c196c38ec 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -33,7 +33,7 @@ Title Paragraph. """, """\ -<document id="title" name="title" source="test data"> +<document ids="title" names="title" source="test data"> <title> Title <comment xml:space="preserve"> @@ -47,7 +47,7 @@ Title Paragraph (no blank line). """, """\ -<document id="title" name="title" source="test data"> +<document ids="title" names="title" source="test data"> <title> Title <paragraph> @@ -65,7 +65,7 @@ Paragraph. <document source="test data"> <paragraph> Paragraph. - <section id="title" name="title"> + <section ids="title" names="title"> <title> Title <paragraph> @@ -81,10 +81,10 @@ Subtitle Test title & subtitle. """, """\ -<document id="title" name="title" source="test data"> +<document ids="title" names="title" source="test data"> <title> Title - <subtitle id="subtitle" name="subtitle"> + <subtitle ids="subtitle" names="subtitle"> Subtitle <paragraph> Test title & subtitle. @@ -96,7 +96,7 @@ Title Test short underline. """, """\ -<document id="title" name="title" source="test data"> +<document ids="title" names="title" source="test data"> <title> Title <system_message level="2" line="2" source="test data" type="WARNING"> @@ -118,7 +118,7 @@ The system_message should move after the document title (it was before the beginning of the section). """, """\ -<document id="long-title" name="long title" source="test data"> +<document ids="long-title" names="long title" source="test data"> <title> Long Title <system_message level="2" line="1" source="test data" type="WARNING"> @@ -149,19 +149,19 @@ Title 3 Paragraph 3. """, """\ -<document id="title-1" name="title 1" source="test data"> +<document ids="title-1" names="title 1" source="test data"> <title> Title 1 <comment xml:space="preserve"> Test multiple second-level titles. <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title> Title 2 <paragraph> Paragraph 2. - <section id="title-3" name="title 3"> + <section ids="title-3" names="title 3"> <title> Title 3 <paragraph> @@ -178,12 +178,12 @@ This title should be the document title despite the substitution_definition. """, """\ -<document id="title" name="title" source="test data"> +<document ids="title" names="title" source="test data"> <title> Title - <substitution_definition name="foo"> + <substitution_definition names="foo"> bar - <target id="invisible-target" name="invisible target"> + <target ids="invisible-target" names="invisible target"> <paragraph> This title should be the document title despite the substitution_definition. -- cgit v1.2.1 From 4ae722d597317382b222737ecf0b898b224dddcd Mon Sep 17 00:00:00 2001 From: wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Wed, 18 May 2005 22:27:52 +0000 Subject: added SectSubTitle transform git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3351 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 37 +++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'test/test_transforms/test_doctitle.py') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index c196c38ec..0e2050494 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -11,7 +11,7 @@ Tests for docutils.transforms.frontmatter.DocTitle. """ from __init__ import DocutilsTestSupport -from docutils.transforms.frontmatter import DocTitle +from docutils.transforms.frontmatter import DocTitle, SectionSubTitle from docutils.parsers.rst import Parser @@ -23,7 +23,7 @@ def suite(): totest = {} -totest['section_headers'] = ((DocTitle,), [ +totest['section_headers'] = ((DocTitle, SectionSubTitle), [ ["""\ .. test title promotion @@ -188,6 +188,39 @@ substitution_definition. This title should be the document title despite the substitution_definition. """], +["""\ +This is no doc title. + +=============== + Section Title +=============== + +Subtitle +======== + +----------------- + Another Section +----------------- + +Another Subtitle +---------------- + +""", +"""\ +<document source="test data"> + <paragraph> + This is no doc title. + <section ids="section-title" names="section title"> + <title> + Section Title + <subtitle ids="subtitle" names="subtitle"> + Subtitle + <section ids="another-section" names="another section"> + <title> + Another Section + <subtitle ids="another-subtitle" names="another subtitle"> + Another Subtitle +"""], ]) -- cgit v1.2.1 From caa4d0fc6528ad55bdd96434d7970ecc86931199 Mon Sep 17 00:00:00 2001 From: goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> Date: Thu, 19 May 2005 00:49:14 +0000 Subject: renamed command-line options for SectSubTitle transform (plural reads better); tweaked test text git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3353 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_doctitle.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/test_transforms/test_doctitle.py') diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 0e2050494..3a672d1c2 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -189,7 +189,7 @@ substitution_definition. substitution_definition. """], ["""\ -This is no doc title. +(Because of this paragraph, the following is not a doc title.) =============== Section Title @@ -209,7 +209,7 @@ Another Subtitle """\ <document source="test data"> <paragraph> - This is no doc title. + (Because of this paragraph, the following is not a doc title.) <section ids="section-title" names="section title"> <title> Section Title -- cgit v1.2.1