-
Notifications
You must be signed in to change notification settings - Fork 302
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
🖊️ Convert input from ask command to booleans #5697
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.
Hi @boryanagoncharenko! This works great and I love it. I won't approve right away because you say:
we cannot fully test the interaction with the 'ask' command.
But we can! Using Cypress we can add a test to check if the behavior is the expected in the website. I can add the test if you want! We already do it with a couple of commands.
4d37872
to
c5a56ae
Compare
Excellent point! Cypress tests are slow so I added only a couple of tests to check the conversion to numbers in level 12 and booleans in level 15. |
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
Fixes #5691
Starting with level 12, we try to convert the input from the ask command to a number (first an int, then a float). If that conversion fails, we keep it as a string. Now that we support boolean values starting with level 15, it makes sense to try and convert the input to a boolean too.
How to test
Note that the added automated tests do not cover the full execution of the programs because we cannot fully test the interaction with the 'ask' command. To test this locally, run the following snippet in level 15:
When the input box appears put in the following:
true
,false
,True
,False
,15
,not_a_boolean
. Note that the print statements should output exactly what you typed in, i.e. if you typedtrue
you should not getTrue
.Change the language to Bulgarian and paste the following input
вярно
(which is True),невярно
(which is False).