-
Notifications
You must be signed in to change notification settings - Fork 4
Add assertTStringEqual()
helper
#73
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
Add assertTStringEqual()
helper
#73
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.
This is a good improvement. Not sure if it'll work as is though.
Lib/test/test_string/_support.py
Outdated
for actual, expected in zip(t.interpolations, interpolations, | ||
strict=True): | ||
if len(expected) == 2: | ||
self.assertEqual(tuple(actual), expected + (None, '')) |
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.
I don't think the tuple(actual)
call will work since Interpolation
is not iterable.
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.
Of course, sorry -- I wrote this on a computer without a working build of the branch. I've pushed a fix.
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.
LGTM! Thanks @AA-Turner!
cc @lysnikolaou
The tests are currently very verbose, as each attribute of each interpolation needs to be tested individually. This PR introduces a helper function to assert that a t-string is equal to a tuple of strings and a sequence of interpolation tuples.
A