Pillow icon indicating copy to clipboard operation
Pillow copied to clipboard

Parametrize test_lib_pack.py

Open Yay295 opened this issue 1 year ago • 4 comments

Yay295 avatar Apr 27 '24 23:04 Yay295

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.

radarhere avatar Jun 21 '24 23:06 radarhere

It's much easier to understand when a test fails.

Yay295 avatar Jun 22 '24 00:06 Yay295

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. https://github.com/python-pillow/Pillow/blob/b55d74bcfe4b4e69a64d09c785552af8dc9f013d/Tests/test_file_webp_metadata.py#L100

radarhere avatar Jun 29 '24 03:06 radarhere

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.

Yay295 avatar Jun 29 '24 04:06 Yay295