File tree 2 files changed +33
-3
lines changed
2 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -1057,6 +1057,38 @@ def test_explicit_parameters_in_docstring(self):
1057
1057
Okay, we're done here.
1058
1058
""" )
1059
1059
1060
+ def test_docstring_with_comments (self ):
1061
+ function = self .parse_function (dedent ("""
1062
+ module foo
1063
+ foo.bar
1064
+ x: int
1065
+ # We're about to have
1066
+ # the documentation for x.
1067
+ Documentation for x.
1068
+ # We've just had
1069
+ # the documentation for x.
1070
+ y: int
1071
+
1072
+ # We're about to have
1073
+ # the documentation for foo.
1074
+ This is the documentation for foo.
1075
+ # We've just had
1076
+ # the documentation for foo.
1077
+
1078
+ Okay, we're done here.
1079
+ """ ))
1080
+ self .checkDocstring (function , """
1081
+ bar($module, /, x, y)
1082
+ --
1083
+
1084
+ This is the documentation for foo.
1085
+
1086
+ x
1087
+ Documentation for x.
1088
+
1089
+ Okay, we're done here.
1090
+ """ )
1091
+
1060
1092
def test_parser_regression_special_character_in_parameter_column_of_docstring_first_line (self ):
1061
1093
function = self .parse_function (dedent ("""
1062
1094
module os
Original file line number Diff line number Diff line change @@ -4685,9 +4685,7 @@ def state_modulename_name(self, line: str) -> None:
4685
4685
# this line is permitted to start with whitespace.
4686
4686
# we'll call this number of spaces F (for "function").
4687
4687
4688
- if not self .valid_line (line ):
4689
- return
4690
-
4688
+ assert self .valid_line (line )
4691
4689
self .indent .infer (line )
4692
4690
4693
4691
# are we cloning?
You can’t perform that action at this time.
0 commit comments