Skip to content
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

Merged
merged 2 commits into from
Oct 18, 2019

Conversation

frgfm
Copy link
Contributor

@frgfm frgfm commented Oct 17, 2019

This PR updates all raw assert to the corresponding unittest.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!

Updated all raw asserts to corresponding unittest.TestCase.assert. See pytorch#1483
@@ -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
Copy link
Contributor

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

Copy link
Contributor

@ekagra-ranjan ekagra-ranjan left a 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```

@frgfm
Copy link
Contributor Author

frgfm commented Oct 17, 2019

Thanks for the feedback @surgan12 @ekagra-ranjan!
I fixed the linting but the job seems to still be failing, do you have any suggestion?
The job seems to point out other tests

Copy link
Member

@fmassa fmassa left a 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.

@fmassa fmassa merged commit 6101f2d into pytorch:master Oct 18, 2019
@frgfm frgfm deleted the test-transform-assert branch October 22, 2019 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants