-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Port Group O test to pytest ref #3945 #3955
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
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.
Thanks @ShrillShrestha ! This looks great, I made some minor comment, LMK what you think
test/test_transforms.py
Outdated
@@ -1834,6 +1764,83 @@ def test_pad_with_mode_F_images(self): | |||
assert_equal(padded_img.size, [edge_size + 2 * pad for edge_size in img.size], check_stride=False) | |||
|
|||
|
|||
def _test_randomness(fn, trans, configs): |
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 fine as-is for me. If we want, we can go one step further about parametrization here. I'm thinking of somthing like this:
@pytest.mark.skipif(stats is None, reason="scipy.stats not available")
@pytest.mark.parametrize('fn, trans, conf', [
(F.invert, transforms.RandomInvert, {}),
(F.posterize, transforms.RandomPosterize, {"bits": 4}),
...
])
@pytest.mark.parametrize('p', (.5, .7))
def test_randomness(fn, trans, conf, p):
and we could get rid of all the other functions and the 2 for loops inside. WDYT?
Again this is optional: feel free to leave as-is if you prefer ;)
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.
Yeah, I think, we can parametrize it. I have made the changes.
Nice! Thanks a lot @ShrillShrestha ! |
@NicolasHug, thanks for guiding me. :) |
Reviewed By: NicolasHug Differential Revision: D29027333 fbshipit-source-id: e9a6e49df429c8c0f5604bcf0963fb43907767a3
Refactor Group O mentioned in #3945
Please let me know if I need to change anything.