Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-106368: Argument clinic: improve coverage for self.valid_line() calls #107641

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,38 @@ def test_explicit_parameters_in_docstring(self):
Okay, we're done here.
""")

def test_docstring_with_comments(self):
function = self.parse_function(dedent("""
module foo
foo.bar
x: int
# We're about to have
# the documentation for x.
Documentation for x.
# We've just had
# the documentation for x.
y: int

# We're about to have
# the documentation for foo.
This is the documentation for foo.
# We've just had
# the documentation for foo.

Okay, we're done here.
"""))
self.checkDocstring(function, """
bar($module, /, x, y)
--

This is the documentation for foo.

x
Documentation for x.

Okay, we're done here.
""")

def test_parser_regression_special_character_in_parameter_column_of_docstring_first_line(self):
function = self.parse_function(dedent("""
module os
Expand Down
4 changes: 1 addition & 3 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4685,9 +4685,7 @@ def state_modulename_name(self, line: str) -> None:
# this line is permitted to start with whitespace.
# we'll call this number of spaces F (for "function").

if not self.valid_line(line):
return

assert self.valid_line(line)
self.indent.infer(line)

# are we cloning?
Expand Down