Skip to content

Conversation

@ZRexshima
Copy link

I added a test to check the error code of figlet.py run without arguments.

There was not a test for exit code when running figlet.py without arguments. This is a requirement for the assignment that should randomly select a font, prompt for input, then output the ASCII art.

This is a replacement of PR #275. This time it only has the individual change.

@rongxin-liu rongxin-liu added the CS50P CS50 Python label Aug 29, 2024
@bxngyn bxngyn self-assigned this Jun 25, 2025
Copy link
Contributor

@bxngyn bxngyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting a PR!

In test_no_arguments, the if condition and the raise statement are mismatched. Also, I believe that since the program is waiting for the user's input, we should use prompt=True. Essentially, if figlet.py is ran without any args and a valid std input (expected behavior), then we would expect a successful exit code of 0, but the raise statement doesn't match this expectation.

@bxngyn bxngyn requested review from rongxin-liu and removed request for patrickthornton June 25, 2025 15:31
Copy link
Contributor

@rongxin-liu rongxin-liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Echoing @bxngyn, I think we can simply test whether running the program without interacting with it returns an exit code of 0. If it does, then the program fails the no arguments test, because it should exit with a non-zero code when no arguments are provided.

@ZRexshima
Copy link
Author

I changed the prompt argument to True and changed the messaging for clarity.

@ZRexshima ZRexshima requested a review from rongxin-liu June 26, 2025 23:00
@rongxin-liu rongxin-liu requested a review from bxngyn June 27, 2025 04:58
@rongxin-liu
Copy link
Contributor

Thank you!

@rongxin-liu rongxin-liu merged commit e450e34 into cs50:2022/python Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CS50P CS50 Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants