summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2023-08-01 23:32:27 (GMT)
committerGitHub <noreply@github.com>2023-08-01 23:32:27 (GMT)
commitb4d889778198e11257c3ed7ab456539b3933d737 (patch)
treee6707ef8cfdd05198549c9fc97c147e14a46170f /Lib
parent818c83cf819244bb0e77d956d28b84dd7434cabb (diff)
downloadcpython-b4d889778198e11257c3ed7ab456539b3933d737.zip
cpython-b4d889778198e11257c3ed7ab456539b3933d737.tar.gz
cpython-b4d889778198e11257c3ed7ab456539b3933d737.tar.bz2
gh-104683: Argument Clinic: Refactor and simplify 'add docstring' states (#107550)
Introduce docstring_append() helper, and use it for both parameter and function docstrings. Remove docstring fixup from do_post_block_processing_cleanup(); instead, make sure no fixup is needed. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_clinic.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py
index 6100444..6bdc571 100644
--- a/Lib/test/test_clinic.py
+++ b/Lib/test/test_clinic.py
@@ -648,6 +648,28 @@ class ClinicParserTest(_ParserBase):
Path to be examined
""")
+ def test_docstring_trailing_whitespace(self):
+ function = self.parse_function(
+ "module t\n"
+ "t.s\n"
+ " a: object\n"
+ " Param docstring with trailing whitespace \n"
+ "Func docstring summary with trailing whitespace \n"
+ " \n"
+ "Func docstring body with trailing whitespace \n"
+ )
+ self.checkDocstring(function, """
+ s($module, /, a)
+ --
+
+ Func docstring summary with trailing whitespace
+
+ a
+ Param docstring with trailing whitespace
+
+ Func docstring body with trailing whitespace
+ """)
+
def test_explicit_parameters_in_docstring(self):
function = self.parse_function(dedent("""
module foo