-
Notifications
You must be signed in to change notification settings - Fork 7k
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
test: Updated assert in test_transforms #1487
Conversation
Updated all raw asserts to corresponding unittest.TestCase.assert. See pytorch#1483
test/test_transforms.py
Outdated
@@ -150,12 +150,12 @@ def test_randomresized_params(self): | |||
randresizecrop = transforms.RandomResizedCrop(size, scale_range, aspect_ratio_range) | |||
i, j, h, w = randresizecrop.get_params(img, scale_range, aspect_ratio_range) | |||
aspect_ratio_obtained = w / h | |||
assert (min(aspect_ratio_range) - epsilon <= aspect_ratio_obtained <= max(aspect_ratio_range) + epsilon or | |||
self.assertTrue(min(aspect_ratio_range) - epsilon <= aspect_ratio_obtained <= max(aspect_ratio_range) + epsilon or |
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.
It seems lint is failing here due to long line. Could you just check it
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.
The lint is failing here too:
./test/test_transforms.py:1131:17: E128 continuation line under-indented for visual indent
./test/test_transforms.py:1131:66: E502 the backslash is redundant between brackets
./test/test_transforms.py:1132:17: E128 continuation line under-indented for visual indent```
Thanks for the feedback @surgan12 @ekagra-ranjan! |
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 a lot!
@frgfm the test failures are unrelated I believe, so I'm merging this.
This PR updates all raw
assert
to the correspondingunittest.TestCase
assert method for tests related to torchvision.transforms as suggested by #1483.The specific test was run locally with success, any feedback is welcome!