-
-
Notifications
You must be signed in to change notification settings - Fork 582
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
cleanup of pretty
output renderer
#708
Comments
What do you think of this output, @Julian, with divisions padded to a width of 79 characters per line?
|
Very nice! Definitely an improvement! Thumbs up from me. |
Perhaps off-topic: The error message '{'const': 7} is not allowed for 7' seems odd. Unlike the other two messages in this example, the value being tested (7) comes at the end of the statement and the JSON code seems unnecessary. I think a better error message would be simply If you agree, should this be a new issue, or would it be OK for me to change it as part of this issue and PR? |
I agree on the awkwardness -- let's tackle it in a new issue -- the thing that is a bit complicated is that what's involved there is less about |
Unicode box characters, true JSON output, (slightly) more space between each error, etc.
I'll open a new issue for the "not" error message. |
Only use JSON formatting for exception messages when explicitly requested.
As clarified in PR, not all exception output needs to use valid JSON. Add a message formatter method to the exception class and pass in a formatter lambda/function when needed. Updated tests with the new expected output format.
Also update the tests! 🤦♂️
These are not needed, as I expected. They may even contribute to the "buffer interface" errors.
From one version of Python to another, the "type" that appears in brackets may be of differing lengths. (E.g., `JSONDecodeError` in Python 3, but `ValueError` in Python 2.) That would make the length of the Unicode bar different under each version of Python. When these tests were corrected to work under Python 2, they wouldn't work under Python 3 and vice versa. Therefore, it's simpler to break the single assertions into two shorter ones that use very little of the bar characters.
For Python interpreters that don't treat multibyte Unicode characters as single characters, add some code to manually calculate the number of bar characters required to reach the desired line length. This code is confined to a conditional block and may be removed when support for older interpreters is no longer needed.
With any luck, it will resolve the coverage issues, too.
As per code review discussion.
Superceded by check-jsonschema which is now the official (and more-featureful) CLI. Anyone interested in this is invited to have a look there (and file any issues necessary). |
Based on a conversation started in the comments of #706, clean up the appearance of the new
pretty
output renderer. Pertinent points from the conversation…=
and-
lines do not match)repr
s (with single-quoted strings) to true JSON (with double-quoted strings)Details
I think more important than adding even more output renderers is essentially cleaning up the one new one that was added. Specifically, here's some example output from the new pretty renderer:where some things that rub me a bit wrong visually are:
=
and-
lines -- particularly so if it's aSchemaError
vs aValidationError
)The text was updated successfully, but these errors were encountered: