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_substitutions.py | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 test/test_transforms/test_substitutions.py (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py new file mode 100755 index 000000000..693c734a2 --- /dev/null +++ b/test/test_transforms/test_substitutions.py @@ -0,0 +1,61 @@ +#! /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.references.Substitutions. +""" + +import DocutilsTestSupport +import UnitTestFolder +from docutils.transforms.references import Substitutions +from docutils.parsers.rst import Parser + + +def suite(): + parser = Parser() + s = DocutilsTestSupport.TransformTestSuite(parser) + s.generateTests(totest) + return s + +totest = {} + +totest['substitutions'] = ((Substitutions,), [ +["""\ +The |biohazard| symbol is deservedly scary-looking. + +.. |biohazard| image:: biohazard.png +""", +"""\ + + + The + biohazard + symbol is deservedly scary-looking. + + biohazard +"""], +["""\ +Here's an |unknown| substitution. +""", +"""\ + + + Here's an + + |unknown| + substitution. + + + Undefined substitution referenced: "unknown". +"""], +]) + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') -- cgit v1.2.1 From 0ec60c8d82032a385f374ded26617fd076442414 Mon Sep 17 00:00:00 2001 From: goodger 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_substitutions.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 693c734a2..c02dd0218 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -10,8 +10,7 @@ Tests for docutils.transforms.references.Substitutions. """ -import DocutilsTestSupport -import UnitTestFolder +from __init__ import DocutilsTestSupport from docutils.transforms.references import Substitutions from docutils.parsers.rst import Parser -- cgit v1.2.1 From 34f7a6d1ac6f52cf920a933aba804f54c7be5525 Mon Sep 17 00:00:00 2001 From: goodger Date: Sun, 5 May 2002 15:49:41 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@91 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index c02dd0218..f1cd8aece 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -32,7 +32,7 @@ The |biohazard| symbol is deservedly scary-looking. """\ - The + The \n\ biohazard symbol is deservedly scary-looking. @@ -44,7 +44,7 @@ Here's an |unknown| substitution. """\ - Here's an + Here's an \n\ |unknown| substitution. -- cgit v1.2.1 From 13ed20d392cc6c5e727344dad0c3aca8cea125f1 Mon Sep 17 00:00:00 2001 From: goodger 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_substitutions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index f1cd8aece..763cd8311 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -30,7 +30,7 @@ The |biohazard| symbol is deservedly scary-looking. .. |biohazard| image:: biohazard.png """, """\ - + The \n\ biohazard @@ -42,13 +42,13 @@ The |biohazard| symbol is deservedly scary-looking. Here's an |unknown| substitution. """, """\ - + Here's an \n\ |unknown| substitution. - + Undefined substitution referenced: "unknown". """], -- cgit v1.2.1 From 58036bb54a184a823272be8ddf5f52c619d4f83c Mon Sep 17 00:00:00 2001 From: goodger 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_substitutions.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 763cd8311..ad411db43 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.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.references.Substitutions. """ @@ -48,7 +48,7 @@ Here's an |unknown| substitution. |unknown| substitution. - + Undefined substitution referenced: "unknown". """], -- cgit v1.2.1 From 1c87d959eb6be73667ca61bbb48d69b075a846df Mon Sep 17 00:00:00 2001 From: goodger Date: Thu, 27 Mar 2003 03:56:37 +0000 Subject: substitutions made case-sensitive but forgiving (case-insensitive fallback) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@1236 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index ad411db43..eec8c632f 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -52,6 +52,30 @@ Here's an |unknown| substitution. Undefined substitution referenced: "unknown". """], +[u"""\ +Substitutions support case differences: + +.. |eacute| replace:: \u00E9 +.. |Eacute| replace:: \u00C9 + +|Eacute|\\t\\ |eacute|, and even |EACUTE|. +""", +u"""\ + + + Substitutions support case differences: + + \u00E9 + + \u00C9 + + \u00C9 + t + \u00E9 + , and even \n\ + \u00C9 + . +"""], ]) -- cgit v1.2.1 From e8c6ddb8ee857e0387997db70b0786243465b84b Mon Sep 17 00:00:00 2001 From: goodger Date: Sat, 24 May 2003 20:54:11 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@1340 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index eec8c632f..4c17bd8c8 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -78,6 +78,35 @@ u"""\ """], ]) +totest['unicode'] = ((Substitutions,), [ +["""\ +Insert an em-dash (|mdash|), a copyright symbol (|copy|), and a non-breaking +space (|nbsp|). + +.. |mdash| unicode:: 0x02014 +.. |copy| unicode:: \\u00A9 +.. |nbsp| unicode::   +""", +u"""\ + + + Insert an em-dash ( + \u2014 + ), a copyright symbol ( + \u00A9 + ), and a non-breaking + space ( + \u00A0 + ). + + \u2014 + + \u00A9 + + \u00A0 +"""], +]) + if __name__ == '__main__': import unittest -- cgit v1.2.1 From 3fab0871cb6fe950ee158b55146df0b57579dfa1 Mon Sep 17 00:00:00 2001 From: goodger Date: Thu, 12 Jun 2003 19:35:45 +0000 Subject: updated git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@1434 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 4c17bd8c8..46c36dd9c 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -80,12 +80,14 @@ u"""\ totest['unicode'] = ((Substitutions,), [ ["""\ -Insert an em-dash (|mdash|), a copyright symbol (|copy|), and a non-breaking -space (|nbsp|). +Insert an em-dash (|mdash|), a copyright symbol (|copy|), a non-breaking +space (|nbsp|), a backwards-not-equals (|bne|), and a captial omega (|Omega|). .. |mdash| unicode:: 0x02014 .. |copy| unicode:: \\u00A9 .. |nbsp| unicode::   +.. |bne| unicode:: U0003D U020E5 +.. |Omega| unicode:: U+003A9 """, u"""\ @@ -93,17 +95,27 @@ u"""\ Insert an em-dash ( \u2014 ), a copyright symbol ( - \u00A9 - ), and a non-breaking + \u00a9 + ), a non-breaking space ( - \u00A0 + \u00a0 + ), a backwards-not-equals ( + = + \u20e5 + ), and a captial omega ( + \u03a9 ). \u2014 - \u00A9 + \u00a9 - \u00A0 + \u00a0 + + = + \u20e5 + + \u03a9 """], ]) -- cgit v1.2.1 From 34e673460e676a67ed552c7c66e2381c6e0c2dbb Mon Sep 17 00:00:00 2001 From: goodger Date: Sun, 22 Jun 2003 22:21:28 +0000 Subject: added comments to "unicode" directive git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@1494 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 46c36dd9c..503dfba40 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -117,6 +117,32 @@ u"""\ \u03a9 """], +[""" +Testing comments and extra text. + +Copyright |copy| 2003, |BogusMegaCorp (TM)|. + +.. |copy| unicode:: 0xA9 .. copyright sign +.. |BogusMegaCorp (TM)| unicode:: BogusMegaCorp U+2122 + .. with trademark sign +""", +u"""\ + + + Testing comments and extra text. + + Copyright \n\ + \u00a9 + 2003, \n\ + BogusMegaCorp + \u2122 + . + + \u00a9 + + BogusMegaCorp + \u2122 +"""], ]) -- cgit v1.2.1 From 9e41a6191aee10eedfa1df2d0d10a4700a194e55 Mon Sep 17 00:00:00 2001 From: goodger Date: Tue, 2 Nov 2004 22:14:24 +0000 Subject: Added support for trimming whitespace from beside substitution references. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2796 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 503dfba40..687a20ca5 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -143,6 +143,29 @@ u"""\ BogusMegaCorp \u2122 """], +["""\ +Insert an em-dash |---| automatically trimming whitespace. +Some substitutions |TM| only need trimming on one side. + +.. |---| unicode:: U+02014 + :trim: +.. |TM| unicode:: U+02122 + :ltrim: +""", +u"""\ + + + Insert an em-dash + \u2014 + automatically trimming whitespace. + Some substitutions + \u2122 + only need trimming on one side. + + \u2014 + + \u2122 +"""], ]) -- cgit v1.2.1 From 9dbc2adead008935245a396eab10bb7bcb11b226 Mon Sep 17 00:00:00 2001 From: wiemann 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_substitutions.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 687a20ca5..33a33b754 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -35,7 +35,7 @@ The |biohazard| symbol is deservedly scary-looking. The \n\ biohazard symbol is deservedly scary-looking. - + biohazard """], ["""\ @@ -45,10 +45,10 @@ Here's an |unknown| substitution. Here's an \n\ - + |unknown| substitution. - + Undefined substitution referenced: "unknown". """], @@ -64,9 +64,9 @@ u"""\ Substitutions support case differences: - + \u00E9 - + \u00C9 \u00C9 @@ -105,16 +105,16 @@ u"""\ ), and a captial omega ( \u03a9 ). - + \u2014 - + \u00a9 - + \u00a0 - + = \u20e5 - + \u03a9 """], [""" @@ -137,9 +137,9 @@ u"""\ BogusMegaCorp \u2122 . - + \u00a9 - + BogusMegaCorp \u2122 """], @@ -161,9 +161,9 @@ u"""\ Some substitutions \u2122 only need trimming on one side. - + \u2014 - + \u2122 """], ]) -- cgit v1.2.1 From 3cb6c0f587d0b5ebe3f55b206d80ed03a684dd34 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 14 Aug 2005 23:18:36 +0000 Subject: removed bug with indirect substitutions; seems to be fixed git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3807 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 33a33b754..67aa3dfed 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -76,6 +76,31 @@ u"""\ \u00C9 . """], +[u"""\ +Indirect substitution definitions with multiple references: + +|substitute| my coke for gin +|substitute| you for my mum +at least I'll get my washing done + +.. |substitute| replace:: |replace| +.. |replace| replace:: swap +""", +u"""\ + + + Indirect substitution definitions with multiple references: + + swap + my coke for gin + swap + you for my mum + at least I'll get my washing done + + swap + + swap +"""], ]) totest['unicode'] = ((Substitutions,), [ -- cgit v1.2.1 From 74e448e6230eaaf792f6fe2b0c936cb9bdfeaf41 Mon Sep 17 00:00:00 2001 From: goodger Date: Mon, 15 Aug 2005 19:45:02 +0000 Subject: restored a bug (removed in r3807) which lingers; added a commented-out test case for said bug; removed a bogus bug git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3809 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 67aa3dfed..19534a486 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -101,6 +101,51 @@ u"""\ swap """], +#["""\ +#.. |l| unicode:: U+00AB .. left chevron +#.. |r| unicode:: U+00BB .. right chevron +#.. |.| replace:: |l|\ ``.``\ |r| +# +#.. Delete either of the following lines, and there is no error. +# +#Regular expression |.| will match any character +# +#.. Note:: Note that |.| matches *exactly* one character +#""", +#u"""\ +# +# +# \xab +# +# \xbb +# +# +# l +# +# . +# +# r +# +# Delete either of the following lines, and there is no error. +# +# Regular expression \n\ +# \xab +# +# . +# \xbb +# will match any character +# +# +# Note that \n\ +# \xab +# +# . +# \xbb +# matches \n\ +# +# exactly +# one character +#"""], ]) totest['unicode'] = ((Substitutions,), [ -- cgit v1.2.1 From fa67b65d49e091aec810d2e5e8db5b19fc5be2d5 Mon Sep 17 00:00:00 2001 From: goodger Date: Sun, 2 Oct 2005 01:06:42 +0000 Subject: 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 --- test/test_transforms/test_substitutions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/test_transforms/test_substitutions.py') 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"""\ . \u00a9 - + BogusMegaCorp \u2122 """], -- cgit v1.2.1 From 8caecfa4637c4690054d994722b629f5dba32721 Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 11 Oct 2005 17:51:38 +0000 Subject: disallow targets inside substitution definitions git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3933 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 723f01473..8a09fe109 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -236,6 +236,30 @@ u"""\ \u2122 """], +["""\ +Substitution definition with a target: + +.. |target| replace:: _`target` + +Make sure this substitution definition is not registered: |target| +""", +"""\ + + + Substitution definition with a target: + + + Substitution definitions may not contain targets. + + .. |target| replace:: _`target` + + Make sure this substitution definition is not registered: \n\ + + |target| + + + Undefined substitution referenced: "target". +"""], ]) -- cgit v1.2.1 From 8ca484acd7f7fbc2990475a22fb1089b022e5571 Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 11 Oct 2005 19:34:52 +0000 Subject: added Node.deepcopy(); fixed bug with doubly-indirect substitutions git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3935 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 88 +++++++++++++++--------------- 1 file changed, 43 insertions(+), 45 deletions(-) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 8a09fe109..ba98e1aa1 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -101,51 +101,49 @@ u"""\ swap """], -#["""\ -#.. |l| unicode:: U+00AB .. left chevron -#.. |r| unicode:: U+00BB .. right chevron -#.. |.| replace:: |l|\ ``.``\ |r| -# -#.. Delete either of the following lines, and there is no error. -# -#Regular expression |.| will match any character -# -#.. Note:: Note that |.| matches *exactly* one character -#""", -#u"""\ -# -# -# \xab -# -# \xbb -# -# -# l -# -# . -# -# r -# -# Delete either of the following lines, and there is no error. -# -# Regular expression \n\ -# \xab -# -# . -# \xbb -# will match any character -# -# -# Note that \n\ -# \xab -# -# . -# \xbb -# matches \n\ -# -# exactly -# one character -#"""], +["""\ +.. |l| unicode:: U+00AB .. left chevron +.. |r| unicode:: U+00BB .. right chevron +.. |.| replace:: |l|\ ``.``\ |r| + +.. Delete either of the following lines, and there is no error. + +Regular expression |.| will match any character + +.. Note:: Note that |.| matches *exactly* one character +""", +u"""\ + + + \xab + + \xbb + + \xab + + . + \xbb + + Delete either of the following lines, and there is no error. + + Regular expression \n\ + \xab + + . + \xbb + will match any character + + + Note that \n\ + \xab + + . + \xbb + matches \n\ + + exactly + one character +"""], ]) totest['unicode'] = ((Substitutions,), [ -- cgit v1.2.1 From 7068fae26ee297f883adf5f884fd64b0892b2a70 Mon Sep 17 00:00:00 2001 From: wiemann Date: Tue, 11 Oct 2005 20:40:41 +0000 Subject: disallow anonymous hyperlink references and auto-numbered footnotes inside of substitution definitions git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3937 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index ba98e1aa1..aa3a7c6f6 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -235,7 +235,7 @@ u"""\ \u2122 """], ["""\ -Substitution definition with a target: +Substitution definition with an illegal element: .. |target| replace:: _`target` @@ -244,10 +244,13 @@ Make sure this substitution definition is not registered: |target| """\ - Substitution definition with a target: - + Substitution definition with an illegal element: + - Substitution definitions may not contain targets. + Substitution definition contains illegal element: + + + target .. |target| replace:: _`target` -- cgit v1.2.1 From a4dc6c54aafa689141243e1e837dc2bc3b236939 Mon Sep 17 00:00:00 2001 From: goodger Date: Wed, 28 Dec 2005 23:48:48 +0000 Subject: Fixed bug with circular substitution definitions that put Docutils into an infinite loop. Circular substitution definitions are now detected & reported. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4233 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_transforms/test_substitutions.py | 84 ++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'test/test_transforms/test_substitutions.py') diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index aa3a7c6f6..196bec9a1 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -144,6 +144,90 @@ u"""\ exactly one character """], +["""\ +.. |sub| replace:: |sub| +""", +"""\ + + + + Circular substitution definition detected: + + .. |sub| replace:: |sub| +"""], +["""\ +.. |sub| replace:: |indirect1| +.. |indirect1| replace:: |indirect2| +.. |indirect2| replace:: |Sub| +""", +"""\ + + + + Circular substitution definition detected: + + .. |sub| replace:: |indirect1| + + + Circular substitution definition detected: + + .. |indirect1| replace:: |indirect2| + + + Circular substitution definition detected: + + .. |indirect2| replace:: |Sub| +"""], +["""\ +.. |indirect1| replace:: |indirect2| +.. |indirect2| replace:: |Sub| +.. |sub| replace:: |indirect1| + +Use |sub| and |indirect1| and |sub| again (and |sub| one more time). +""", +"""\ + + + + Circular substitution definition detected: + + .. |indirect1| replace:: |indirect2| + + + Circular substitution definition detected: + + .. |indirect2| replace:: |Sub| + + + Circular substitution definition detected: + + .. |sub| replace:: |indirect1| + + Use \n\ + + and \n\ + + |indirect1| + and \n\ + + |sub| + again (and \n\ + + |sub| + one more time). + + + Circular substitution definition referenced: "indirect1". + + + Circular substitution definition referenced: "sub". + + + Circular substitution definition referenced: "sub". + + + Circular substitution definition referenced: "Sub". +"""], ]) totest['unicode'] = ((Substitutions,), [ -- cgit v1.2.1