mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-22 07:10:34 +08:00
Always print message on test failure
Summary: make assertClose print its failure information even if a message is supplied. Reviewed By: nikhilaravi Differential Revision: D28799745 fbshipit-source-id: 787c8c356342420cd8f40fdc0b2aba036142298e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7fd7de4451
commit
070ec550d3
@@ -36,7 +36,8 @@ class TestOpsUtils(TestCaseMixin, unittest.TestCase):
|
||||
self.assertClose(to_np(x), to_np(x_noise), atol=10 * noise_std)
|
||||
with self.assertRaises(AssertionError) as context:
|
||||
self.assertClose(to_np(x), to_np(x_noise), atol=0.1 * noise_std, msg=msg)
|
||||
self.assertTrue(msg in str(context.exception))
|
||||
self.assertIn(msg, str(context.exception))
|
||||
self.assertIn("Not close", str(context.exception))
|
||||
|
||||
# test relative tolerance
|
||||
assert torch.allclose(x, x_noise, rtol=100 * noise_std)
|
||||
|
||||
Reference in New Issue
Block a user