diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-02-12 00:28:18 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-02-12 00:50:56 +0900 |
commit | 8224f6f44adb842968c696c890c04f74e4ea60d5 (patch) | |
tree | 4032dfc2677fd9dd3d12840154cdaf0bac07c491 /tests/test_ext_napoleon_docstring.py | |
parent | a32d60906176cf19fdc83da85836aa254f7fb848 (diff) | |
download | sphinx-git-8224f6f44adb842968c696c890c04f74e4ea60d5.tar.gz |
Fix #10181: napoleon_use_ivar adds unexpected prefix to vars
Since 4.0, :ivar: items has not been rendered as hyperlinks. So any
modules, classes and tilda are now harmful. This removes the prefixing
filter for napoleon_use_ivar option.
refs: #5129 and #5977
Diffstat (limited to 'tests/test_ext_napoleon_docstring.py')
-rw-r--r-- | tests/test_ext_napoleon_docstring.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_ext_napoleon_docstring.py b/tests/test_ext_napoleon_docstring.py index f0399a894..21278dbca 100644 --- a/tests/test_ext_napoleon_docstring.py +++ b/tests/test_ext_napoleon_docstring.py @@ -483,6 +483,22 @@ Attributes: :type: numpy.ndarray """ + + def test_attributes_with_use_ivar(self): + docstring = """\ +Attributes: + foo (int): blah blah + bar (str): blah blah +""" + + config = Config(napoleon_use_ivar=True) + actual = str(GoogleDocstring(docstring, config, obj=self.__class__)) + expected = """\ +:ivar foo: blah blah +:vartype foo: int +:ivar bar: blah blah +:vartype bar: str +""" self.assertEqual(expected, actual) def test_code_block_in_returns_section(self): |