-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Parametrize test_lib_pack.py #8026
base: main
Are you sure you want to change the base?
Conversation
mode: str, rawmode: str, data: int | bytes, pixels: list[float | tuple[int, ...]] | ||
) -> None: | ||
with pytest.raises(ValueError): | ||
test_unpack(mode, rawmode, data, pixels) |
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.
Calling one test from another seems odd, and a potential source of confusion?
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 could make test_unpack
not a test function, and have all three test functions call that, but I don't see how that would be any clearer.
84850ef
to
7a474fc
Compare
b0a2b1e
to
1fa2ace
Compare
a7b62a4
to
39d1fb5
Compare
39d1fb5
to
9b6dbba
Compare
I understand there's a lot of repetition in this file, but I don't think that this version is easier to understand. If others think it is easier to understand, that's fine, but those are my thoughts on the matter. |
It's much easier to understand when a test fails. |
bf9cc8a
to
7458a24
Compare
While I recognise I'm not as fond of parametrisation as others, I think over 200 and 500 lines of code to construct the parameters is a bit much. If the concern is about clarity when a test fails, maybe just adding a message to the assertion would be a smaller change with a similar effect? Something like this, but with the details about which case failed as the message. Pillow/Tests/test_file_webp_metadata.py Line 100 in b55d74b
|
The main benefit I see for parametrization is that each assert can fail on its own, instead of the test stopping at the first failed assert. |
07efbd8
to
576d001
Compare
b662aef
to
d72e29f
Compare
0bc6c55
to
474e85b
Compare
474e85b
to
35be6ec
Compare
35be6ec
to
37280ee
Compare
37280ee
to
46cdd31
Compare
46cdd31
to
111994a
Compare
111994a
to
edb8efd
Compare
edb8efd
to
9c64378
Compare
No description provided.