summaryrefslogtreecommitdiff
path: root/tests/test_domain_py.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-16 21:51:46 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-16 21:51:46 +0900
commit30f8640bab786b28e2fbc3a12a4cf212e6f953d1 (patch)
treef5cf23900a7bc509fe970262195995ddc526fda1 /tests/test_domain_py.py
parent5460ea103bd91ce910e50e11e05c1e5340c2a9e0 (diff)
parent7c340e1c1c43f173f11efc14feb29cd08cedb995 (diff)
downloadsphinx-git-30f8640bab786b28e2fbc3a12a4cf212e6f953d1.tar.gz
Merge branch '3.x'
Diffstat (limited to 'tests/test_domain_py.py')
-rw-r--r--tests/test_domain_py.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py
index 537bae15b..a1e37fa5e 100644
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -8,6 +8,7 @@
:license: BSD, see LICENSE for details.
"""
+import re
import sys
from unittest.mock import Mock
@@ -132,6 +133,29 @@ def test_domain_py_xrefs(app, status, warning):
assert len(refnodes) == 2
+@pytest.mark.sphinx('html', testroot='domain-py')
+def test_domain_py_xrefs_abbreviations(app, status, warning):
+ app.builder.build_all()
+
+ content = (app.outdir / 'abbr.html').read_text()
+ assert re.search(r'normal: <a .* href="module.html#module_a.submodule.ModTopLevel.'
+ r'mod_child_1" .*><.*>module_a.submodule.ModTopLevel.mod_child_1\(\)'
+ r'<.*></a>',
+ content)
+ assert re.search(r'relative: <a .* href="module.html#module_a.submodule.ModTopLevel.'
+ r'mod_child_1" .*><.*>ModTopLevel.mod_child_1\(\)<.*></a>',
+ content)
+ assert re.search(r'short name: <a .* href="module.html#module_a.submodule.ModTopLevel.'
+ r'mod_child_1" .*><.*>mod_child_1\(\)<.*></a>',
+ content)
+ assert re.search(r'relative \+ short name: <a .* href="module.html#module_a.submodule.'
+ r'ModTopLevel.mod_child_1" .*><.*>mod_child_1\(\)<.*></a>',
+ content)
+ assert re.search(r'short name \+ relative: <a .* href="module.html#module_a.submodule.'
+ r'ModTopLevel.mod_child_1" .*><.*>mod_child_1\(\)<.*></a>',
+ content)
+
+
@pytest.mark.sphinx('dummy', testroot='domain-py')
def test_domain_py_objects(app, status, warning):
app.builder.build_all()