-
-
Notifications
You must be signed in to change notification settings - Fork 161
Open
Labels
Description
Current functionality will add Exceptions for lines that are prefixed with raise. It would be good to have the docstrings to include any lines that are prefixed with assert also. Because these will raise the AssertionError, and therefore should be included.
Versions (please complete the following information):
- autoDocstring Version:
0.5.4 - Operating System: Windows 10 Enterprise
- Vscode Version:
1.54.3
Original Code (with line to generate on):
def test_func(param_1:str, param_2:str="foo"):
assert isinstance(param_1, str), "`input` must be type `str`."
if not isinstance(param_2, str): raise TypeError("`input` must be type `str`.")
return param_1.upper()Expected Result:
def test_func(param_1:str, param_2:str="foo"):
"""
[summary]
Args:
param_1 (str): [description]
param_2 (str, optional): [description]. Defaults to "foo".
Raises:
AssertionError: [description]
TypeError: [description]
Returns:
[type]: [description]
"""
assert isinstance(param_1, str), "`param_1` must be type `str`."
if not isinstance(param_2, str): raise TypeError("`param_2` must be type `str`.")
return param_1.upper()Actual Result:
def test_func(param_1:str, param_2:str="foo"):
"""
[summary]
Args:
param_1 (str): [description]
param_2 (str, optional): [description]. Defaults to "foo".
Raises:
TypeError: [description]
Returns:
[type]: [description]
"""
assert isinstance(param_1, str), "`param_1` must be type `str`."
if not isinstance(param_2, str): raise TypeError("`param_2` must be type `str`.")
return param_1.upper()