summaryrefslogtreecommitdiff
path: root/tests/test_ext_napoleon_docstring.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_ext_napoleon_docstring.py')
-rw-r--r--tests/test_ext_napoleon_docstring.py50
1 files changed, 24 insertions, 26 deletions
diff --git a/tests/test_ext_napoleon_docstring.py b/tests/test_ext_napoleon_docstring.py
index 2919fa171..ee79cb92c 100644
--- a/tests/test_ext_napoleon_docstring.py
+++ b/tests/test_ext_napoleon_docstring.py
@@ -410,25 +410,24 @@ class GoogleDocstringTest(BaseDocstringTest):
config = Config()
for section, admonition in admonition_map.items():
# Multiline
- actual = str(GoogleDocstring(("{}:\n"
- " this is the first line\n"
- "\n"
- " and this is the second line\n"
- ).format(section), config))
- expect = (".. {}::\n"
+ actual = str(GoogleDocstring(f"{section}:\n"
+ " this is the first line\n"
+ "\n"
+ " and this is the second line\n",
+ config))
+ expect = (f".. {admonition}::\n"
"\n"
" this is the first line\n"
" \n"
" and this is the second line\n"
- ).format(admonition)
+ )
self.assertEqual(expect, actual)
# Single line
- actual = str(GoogleDocstring(("{}:\n"
- " this is a single line\n"
- ).format(section), config))
- expect = (".. {}:: this is a single line\n"
- ).format(admonition)
+ actual = str(GoogleDocstring(f"{section}:\n"
+ " this is a single line\n",
+ config))
+ expect = f".. {admonition}:: this is a single line\n"
self.assertEqual(expect, actual)
def test_docstrings(self):
@@ -1472,27 +1471,26 @@ class NumpyDocstringTest(BaseDocstringTest):
config = Config()
for section, admonition in admonition_map.items():
# Multiline
- actual = str(NumpyDocstring(("{}\n"
- "{}\n"
- " this is the first line\n"
- "\n"
- " and this is the second line\n"
- ).format(section, '-' * len(section)), config))
- expect = (".. {}::\n"
+ actual = str(NumpyDocstring(f"{section}\n"
+ f"{'-' * len(section)}\n"
+ " this is the first line\n"
+ "\n"
+ " and this is the second line\n",
+ config))
+ expect = (f".. {admonition}::\n"
"\n"
" this is the first line\n"
" \n"
" and this is the second line\n"
- ).format(admonition)
+ )
self.assertEqual(expect, actual)
# Single line
- actual = str(NumpyDocstring(("{}\n"
- "{}\n"
- " this is a single line\n"
- ).format(section, '-' * len(section)), config))
- expect = (".. {}:: this is a single line\n"
- ).format(admonition)
+ actual = str(NumpyDocstring(f"{section}\n"
+ f"{'-' * len(section)}\n"
+ f" this is a single line\n",
+ config))
+ expect = f".. {admonition}:: this is a single line\n"
self.assertEqual(expect, actual)
def test_docstrings(self):