diff options
| author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2021-09-20 13:03:39 +0000 |
|---|---|---|
| committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2021-09-20 13:03:39 +0000 |
| commit | c3ddb2d17fe373b8628832bbcd98a2dd76b5c31d (patch) | |
| tree | 97fe98dbfffc35b1a3e35a8f55412c64ad7b3704 /docutils/test/test_transforms | |
| parent | 1004cfee85d9916e48b07ef3877b5dcabb7cdfac (diff) | |
| download | docutils-c3ddb2d17fe373b8628832bbcd98a2dd76b5c31d.tar.gz | |
Skip system_messages when propagating targets. Fixes bug #425.
Testing with "alltests.py" is currently impossible due to
caching (see itest_hyperlinks_de.py)
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8831 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test/test_transforms')
| -rw-r--r-- | docutils/test/test_transforms/itest_hyperlinks_de.py | 76 | ||||
| -rwxr-xr-x | docutils/test/test_transforms/test_hyperlinks.py | 9 |
2 files changed, 80 insertions, 5 deletions
diff --git a/docutils/test/test_transforms/itest_hyperlinks_de.py b/docutils/test/test_transforms/itest_hyperlinks_de.py new file mode 100644 index 000000000..77c32439c --- /dev/null +++ b/docutils/test/test_transforms/itest_hyperlinks_de.py @@ -0,0 +1,76 @@ +#! /usr/bin/env python + +# $Id$ +# Author: David Goodger <goodger@python.org> +# Copyright: This module has been placed in the public domain. + +""" +Tests for docutils.transforms.references.Hyperlinks with non-English language. + +TODO: This test fails currently when run as part of "alltests" because + + - the "info" system-messages for directive fallbacks are only generated + once (the name -> directive mapping is cached in + ``docutils.parsers.rst.directives._directives``). + + - the cache is not reset between after processing a document + (i.e. it contains name -> directive mappings from other tests). + + See also https://sourceforge.net/p/docutils/feature-requests/71/ +""" + +from __future__ import absolute_import + +if __name__ == '__main__': + import __init__ +from test_transforms import DocutilsTestSupport +from docutils.transforms.references import PropagateTargets, \ + AnonymousHyperlinks, IndirectHyperlinks, ExternalTargets, \ + InternalTargets, DanglingReferences +from docutils.parsers.rst import Parser, directives + +def suite(): + parser = Parser() + settings = {} + settings['language_code'] = 'de' + s = DocutilsTestSupport.TransformTestSuite( + parser, suite_settings=settings) + s.generateTests(totest) + return s + +totest = {} + +totest['hyperlinks'] = ((PropagateTargets, AnonymousHyperlinks, + IndirectHyperlinks, ExternalTargets, + InternalTargets, DanglingReferences), [ + +["""\ +Target_ should propagate past the system_message to set "id" on note. + +.. _target: +.. note:: Kurznotiz + :name: mynote +""", +"""\ +<document source="test data"> + <paragraph> + <reference name="Target" refid="target"> + Target + should propagate past the system_message to set "id" on note. + <target refid="target"> + <system_message level="1" line="4" source="test data" type="INFO"> + <paragraph> + No directive entry for "note" in module "docutils.parsers.rst.languages.de". + Using English fallback for directive "note". + <note ids="mynote target" names="mynote target"> + <paragraph> + Kurznotiz + <system_message level="1" source="test data" type="INFO"> + <paragraph> + Using <module 'docutils.languages.de' from '/usr/local/src/docutils-git-svn/docutils/docutils/languages/de.pyc'> for language "de". +"""], +]) + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') diff --git a/docutils/test/test_transforms/test_hyperlinks.py b/docutils/test/test_transforms/test_hyperlinks.py index 8ec258d16..b20b05284 100755 --- a/docutils/test/test_transforms/test_hyperlinks.py +++ b/docutils/test/test_transforms/test_hyperlinks.py @@ -30,9 +30,8 @@ totest = {} # target/reference, direct/indirect, internal/external, and named/anonymous, # plus embedded URIs. totest['exhaustive_hyperlinks'] = ((PropagateTargets, AnonymousHyperlinks, - IndirectHyperlinks, - ExternalTargets, InternalTargets, - DanglingReferences), [ + IndirectHyperlinks, ExternalTargets, + InternalTargets, DanglingReferences), [ ["""\ direct_ external @@ -185,7 +184,7 @@ Direct internal reference: Implicit_ internal <target ids="indirect" names="indirect" refname="implicit"> <paragraph> - Direct internal reference: + Direct internal reference: \n\ <problematic ids="problematic-2" refid="system-message-2"> Implicit_ <system_message backrefs="problematic-1" ids="system-message-1" level="3" line="11" source="test data" type="ERROR"> @@ -840,7 +839,7 @@ Testing an `indirect reference to the table of contents`_. <title refid="toc-entry-1"> Section <paragraph> - Testing an + Testing an \n\ <reference name="indirect reference to the table of contents" refid="table-of-contents"> indirect reference to the table of contents . |
