summaryrefslogtreecommitdiff
path: root/tests/test_domain_py.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_domain_py.py')
-rw-r--r--tests/test_domain_py.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py
index 34c3faa62..a9a729c1f 100644
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -4,6 +4,7 @@ import re
import sys
from unittest.mock import Mock
+import docutils.utils
import pytest
from docutils import nodes
@@ -1359,3 +1360,16 @@ def test_warn_missing_reference(app, status, warning):
assert "index.rst:6: WARNING: undefined label: 'no-label'" in warning.getvalue()
assert ("index.rst:6: WARNING: Failed to create a cross reference. "
"A title or caption not found: 'existing-label'") in warning.getvalue()
+
+
+@pytest.mark.sphinx(confoverrides={'nitpicky': True})
+@pytest.mark.parametrize('include_options', (True, False))
+def test_signature_line_number(app, include_options):
+ text = (".. py:function:: foo(bar : string)\n" +
+ (" :noindexentry:\n" if include_options else ""))
+ doc = restructuredtext.parse(app, text)
+ xrefs = list(doc.findall(condition=addnodes.pending_xref))
+ assert len(xrefs) == 1
+ source, line = docutils.utils.get_source_line(xrefs[0])
+ assert 'index.rst' in source
+ assert line == 1