diff options
| -rw-r--r-- | sphinx/domains/python.py | 6 | ||||
| -rw-r--r-- | tests/test_domain_py.py | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 6646c85be..a749b8745 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -682,7 +682,11 @@ class PyVariable(PyObject): value = self.options.get('value') if value: - signode += addnodes.desc_annotation(value, ' = ' + value) + signode += addnodes.desc_annotation(value, '', + addnodes.desc_sig_space(), + addnodes.desc_sig_punctuation('', '='), + addnodes.desc_sig_space(), + nodes.Text(value)) return fullname, prefix diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py index edab4bfcc..133427f82 100644 --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -537,7 +537,12 @@ def test_pydata_signature(app): [desc_annotation, ([desc_sig_punctuation, ':'], desc_sig_space, [pending_xref, "int"])], - [desc_annotation, " = 1"])], + [desc_annotation, ( + desc_sig_space, + [desc_sig_punctuation, '='], + desc_sig_space, + "1")] + )], desc_content)])) assert_node(doctree[1], addnodes.desc, desctype="data", domain="py", objtype="data", noindex=False) |
