@@ -280,6 +280,13 @@ def sample_func_10(price):
280280
281281Sample docstring."""
282282 pass
283+
284+
285+ def sample_func_11(price):
286+ # type: (int) -> None
287+ """
288+ Sample function with type annotation comment.
289+ """
283290 '''
284291 docstring = helper .get_func_overall_docstring (
285292 py_module_str = py_module_str , func_name = 'sample_func_0' )
@@ -380,6 +387,13 @@ def sample_func_10(price):
380387Sample docstring."""
381388 assert docstring == expected_docstring
382389
390+ docstring = helper .get_func_overall_docstring (
391+ py_module_str = py_module_str ,
392+ func_name = 'sample_func_11' )
393+ expected_docstring = \
394+ """ Sample function with type annotation comment"""
395+ assert docstring , expected_docstring
396+
383397
384398def test__set_docstring_indent_number_to_one ():
385399 docstring = """
@@ -1722,3 +1736,13 @@ def test__add_line_str():
17221736 assert target_str == 'abc'
17231737 target_str = helper ._add_line_str (target_str = 'abc' , line_str = 'def' )
17241738 assert target_str == 'abc\n def'
1739+
1740+
1741+ def test__type_anotation_comment_exists ():
1742+ result = helper ._type_anotation_comment_exists (
1743+ line_str = 'def sample_func():' )
1744+ assert not result
1745+
1746+ result = helper ._type_anotation_comment_exists (
1747+ line_str = ' # type: (int) -> str' )
1748+ assert result
0 commit comments