mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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:
parent
818c83cf81
commit
b4d8897781
2 changed files with 45 additions and 32 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue