mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
ext.napoleon: Do not consume colons within inline code
Fixes gh-7581
This commit is contained in:
@@ -78,15 +78,17 @@ class InlineAttributeTest(BaseDocstringTest):
|
||||
|
||||
def test_class_data_member(self):
|
||||
config = Config()
|
||||
docstring = """data member description:
|
||||
docstring = dedent("""\
|
||||
data member description:
|
||||
|
||||
- a: b
|
||||
"""
|
||||
- a: b
|
||||
""")
|
||||
actual = str(GoogleDocstring(docstring, config=config, app=None,
|
||||
what='attribute', name='some_data', obj=0))
|
||||
expected = """data member description:
|
||||
expected = dedent("""\
|
||||
data member description:
|
||||
|
||||
- a: b"""
|
||||
- a: b""")
|
||||
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
@@ -95,10 +97,30 @@ class InlineAttributeTest(BaseDocstringTest):
|
||||
docstring = """b: data member description with :ref:`reference`"""
|
||||
actual = str(GoogleDocstring(docstring, config=config, app=None,
|
||||
what='attribute', name='some_data', obj=0))
|
||||
expected = """data member description with :ref:`reference`
|
||||
expected = dedent("""\
|
||||
data member description with :ref:`reference`
|
||||
|
||||
:type: b"""
|
||||
:type: b""")
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_class_data_member_inline_no_type(self):
|
||||
config = Config()
|
||||
docstring = """data with ``a : in code`` and :ref:`reference` and no type"""
|
||||
actual = str(GoogleDocstring(docstring, config=config, app=None,
|
||||
what='attribute', name='some_data', obj=0))
|
||||
expected = """data with ``a : in code`` and :ref:`reference` and no type"""
|
||||
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_class_data_member_inline_ref_in_type(self):
|
||||
config = Config()
|
||||
docstring = """:class:`int`: data member description"""
|
||||
actual = str(GoogleDocstring(docstring, config=config, app=None,
|
||||
what='attribute', name='some_data', obj=0))
|
||||
expected = dedent("""\
|
||||
data member description
|
||||
|
||||
:type: :class:`int`""")
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user