-
Notifications
You must be signed in to change notification settings - Fork 303
Open
Labels
Description
In _raw(), all objects (except for lists, EOF, and TIMEOUT) go through this process:
- The object is converted to a string
- Then the object is converted to its escaped representation (using
repr) - This new escaped representation adds quotes around the object, which we remove using
[1:-1] - Finally, we wrap the entire thing in double quotes.
There's a few concerns I have with this:
- Why double quotes? Why not single quotes in cases where single quotes weren't in the string? And why remove quotes just to add them back in?
- Since
MismatchandMissingcall the_rawfunction, even if you enter a non-string input, the error message will spit out what looks to be a string. Take a look at this code:
from check50 import Mismatch
raise Mismatch(1, "1")which outputs
expected: "1"
actual: "1"
Or this code:
from check50 import Missing
raise Missing("1", [1,2,3])which outputs
Did not find "1" in ""1"\n"2"\n"3""