Skip to content

Conversation

@silmeth
Copy link
Contributor

@silmeth silmeth commented Jul 7, 2019

Closes #1088

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
Member

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

@silmeth silmeth Jul 7, 2019

Choose a reason for hiding this comment

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

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
Copy link
Contributor Author

silmeth commented Jul 7, 2019

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 windelbouwman merged commit fabc260 into RustPython:master Jul 7, 2019
@silmeth silmeth deleted the exc-repr branch July 7, 2019 17:47
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