Skip to content

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
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