Skip to content

Commit

Permalink
Ensure warnings are repeated in test, necessary in python2.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchanan authored and soumith committed Jun 11, 2017
1 parent 6928725 commit 21d9b0c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/test_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1201,12 +1201,15 @@ def verifyFallbackWarnings(w):
self.assertTrue(issubclass(w[0].category, UserWarning))
self.assertTrue("Falling back" in str(w[0].message))
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always', UserWarning)
r0 = tensorfn(t0_fn, t1, t2)
verifyFallbackWarnings(w)
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always', UserWarning)
r1 = tensorfn(t1_fn, t0, t2)
verifyFallbackWarnings(w)
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always', UserWarning)
r2 = tensorfn(t2_fn, t0, t1)
verifyFallbackWarnings(w)
self.assertEqual(t0.size(), r0.size())
Expand Down

0 comments on commit 21d9b0c

Please sign in to comment.