FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

make exceptions repr tests Python 3.7-friendly by eval-repr round-trip by silmeth · Pull Request #1117 · RustPython/RustPython · GitHub

Repository navigation

make exceptions repr tests Python 3.7-friendly by eval-repr round-trip - #1117

Merged
windelbouwman merged 3 commits into
RustPython:masterfrom
silmeth:exc-repr
Jul 7, 2019
Merged

windelbouwman merged 3 commits into
RustPython:masterfrom
silmeth:exc-repr

Conversation

silmeth commented Jul 7, 2019

Copy link
Copy Markdown
Contributor

Closes #1088

Comment thread tests/snippets/exceptions.py Outdated
return type(e1) is type(e2) and e1.args == e2.args

def round_trip_repr(e):
assert exceptions_eq(e, eval(repr(e)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nitpicky, but maybe this should return and the assert should be where it's called? That way an error would show the line with the exception variable instead of just the parameters.

silmeth Jul 7, 2019 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I based it on the round_trip_test() from json_snippet.py where it has similar logic. But I agree it’d be a bit nicer to move asserts out of the function. Shall I change it just here, or in both snippets (I haven’t found any other round-tripy utils)?

silmeth commented Jul 7, 2019

Copy link
Copy Markdown
Contributor Author

Also corrected the last test case in json_snippets.py – because of a typo (* instead of **) it did not test what it was supposed to test…

windelbouwman merged commit fabc260 into RustPython:master Jul 7, 2019
silmeth deleted the exc-repr branch July 7, 2019 17:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exceptions.py tests failing on >= 3.7 because repr changed

3 participants


Back | FazBrowse Home | New Git URL