-
Notifications
You must be signed in to change notification settings - Fork 0
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
Ml2 write docstring to file #19
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @Lukman-Lateef. Just some feedback you might want to / might not want to implement
if not isinstance(docstring, str) or not docstring.strip(): | ||
raise ValueError("The docstring is empty, None, or contains only whitespace") | ||
|
||
print("Generated Docstring:\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need these 3 print statements
try: | ||
with open(output_file, 'w') as file: | ||
file.write(docstring) | ||
print(f"Docstring successfully written to {output_file}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
file.write(docstring) | ||
print(f"Docstring successfully written to {output_file}") | ||
except Exception as e: | ||
print(f"An error occurred while writing to the file: {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can keep this, but use raise ValueError
instead :)
"""Fixture for an empty docstring.""" | ||
return " " | ||
|
||
def test_print_only(valid_docstring, capsys): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need this test, but damn I didnt know you could do that. Good stuff though
No description provided.