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>
This commit is contained in:
Erlend E. Aasland 2023-08-02 01:32:27 +02:00 committed by GitHub
parent 818c83cf81
commit b4d8897781
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 32 deletions

View file

@ -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