SF.net SVN: docutils:[10171 ] trunk/docutils/test/test _parsers/test_rst
milde--- via Docutils-checkins <[email protected]> Mon, 16 Jun 2025 22:44:37 +0000
| Newsgroups | gmane.text.docutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 10171
http://sourceforge.net/p/docutils/code/10171
Author: milde
Date: 2025-06-16 22:44:36 +0000 (Mon, 16 Jun 2025)
Log Message:
-----------
Update hyperlink tests.
Reword samples.
Add test case with explicit/embedded external targets (same URI)
Modified Paths:
--------------
trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py
trunk/docutils/test/test_parsers/test_rst/test_targets.py
Modified: trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py 2025-06-16 12:36:11 UTC (rev 10170)
+++ trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py 2025-06-16 22:44:36 UTC (rev 10171)
@@ -1155,31 +1155,36 @@
anonymouscall
"""],
["""\
-Report duplicate refnames. First use: _`named.txt` vs. _`anonymous.html`.
+Report duplicate refname.
-Embedded targets: `<named.txt>`_, `<anonymous.html>`__
+Explicit targets: _`file.txt`, _`file.html`.
+
+Embedded URI: named `<file.txt>`_ and anonymous `<file.html>`__.
""",
"""\
<document source="test data">
<paragraph>
- Report duplicate refnames. First use: \n\
- <target dupnames="named.txt" ids="named-txt">
- named.txt
- vs. \n\
- <target ids="anonymous-html" names="anonymous.html">
- anonymous.html
+ Report duplicate refname.
+ <paragraph>
+ Explicit targets: \n\
+ <target dupnames="file.txt" ids="file-txt">
+ file.txt
+ , \n\
+ <target ids="file-html" names="file.html">
+ file.html
.
- <system_message level="2" line="4" source="test data" type="WARNING">
+ <system_message level="2" line="6" source="test data" type="WARNING">
<paragraph>
- Duplicate explicit target name: "named.txt".
+ Duplicate explicit target name: "file.txt".
<paragraph>
- Embedded targets: \n\
- <reference name="named.txt" refuri="named.txt">
- named.txt
- <target dupnames="named.txt" ids="named-txt-1" refuri="named.txt">
- , \n\
- <reference name="anonymous.html" refuri="anonymous.html">
- anonymous.html
+ Embedded URI: named \n\
+ <reference name="file.txt" refuri="file.txt">
+ file.txt
+ <target dupnames="file.txt" ids="file-txt-1" refuri="file.txt">
+ and anonymous \n\
+ <reference name="file.html" refuri="file.html">
+ file.html
+ .
"""],
]
@@ -1275,31 +1280,44 @@
anonymous reference
"""],
["""\
-Report duplicate refnames: First use: _`named` vs. _`anonymous`.
+Duplicate refnames in references with embedded alias.
-Embedded alias: `named <anonymous_>`_, `ano <anonymous_>`__
+Explicit targets: _`tg1` and _`tg2`.
+
+References with embedded alias: `link <tg1_>`_ and `link <tg2_>`_.
+
+No clash with anonymous reference `link <tg1_>`__.
""",
"""\
<document source="test data">
<paragraph>
- Report duplicate refnames: First use: \n\
- <target dupnames="named" ids="named">
- named
- vs. \n\
- <target ids="anonymous" names="anonymous">
- anonymous
+ Duplicate refnames in references with embedded alias.
+ <paragraph>
+ Explicit targets: \n\
+ <target ids="tg1" names="tg1">
+ tg1
+ and \n\
+ <target ids="tg2" names="tg2">
+ tg2
.
- <system_message backrefs="named-1" level="2" line="4" source="test data" type="WARNING">
+ <system_message backrefs="link-1" level="2" line="6" source="test data" type="WARNING">
<paragraph>
- Duplicate explicit target name: "named".
+ Duplicate explicit target name: "link".
<paragraph>
- Embedded alias: \n\
- <reference name="named" refname="anonymous">
- named
- <target dupnames="named" ids="named-1" refname="anonymous">
- , \n\
- <reference name="ano" refname="anonymous">
- ano
+ References with embedded alias: \n\
+ <reference name="link" refname="tg1">
+ link
+ <target dupnames="link" ids="link" refname="tg1">
+ and \n\
+ <reference name="link" refname="tg2">
+ link
+ <target dupnames="link" ids="link-1" refname="tg2">
+ .
+ <paragraph>
+ No clash with anonymous reference \n\
+ <reference name="link" refname="tg1">
+ link
+ .
"""],
]
Modified: trunk/docutils/test/test_parsers/test_rst/test_targets.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_targets.py 2025-06-16 12:36:11 UTC (rev 10170)
+++ trunk/docutils/test/test_parsers/test_rst/test_targets.py 2025-06-16 22:44:36 UTC (rev 10171)
@@ -222,6 +222,33 @@
<target dupnames="target" ids="target-1" refuri="first">
"""],
["""\
+Duplicate external targets (same URIs):
+
+See the `example <example.rst>`_
+
+See the example_
+
+.. _example: example.rst
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ Duplicate external targets (same URIs):
+ <paragraph>
+ See the \n\
+ <reference name="example" refuri="example.rst">
+ example
+ <target ids="example" names="example" refuri="example.rst">
+ <paragraph>
+ See the \n\
+ <reference name="example" refname="example">
+ example
+ <system_message level="1" line="7" source="test data" type="INFO">
+ <paragraph>
+ Duplicate explicit target name: "example".
+ <target dupnames="example" ids="example-1" refuri="example.rst">
+"""],
+["""\
Duplicate implicit targets.
Title
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.