Commit d409c117 authored by F-G Fernandez's avatar F-G Fernandez Committed by Francisco Massa
Browse files

test: Updated asserts in test_onnx (#1497)

* test: Updated asserts in test_onnx

Updated all raw asserts to corresponding unittest.TestCase.assert. See #1483

* test: Refactored AssertionError

Opted for cleaner raise to avoid error type casting and string conversion
parent 355e9d2f
...@@ -67,9 +67,9 @@ class ONNXExporterTester(unittest.TestCase): ...@@ -67,9 +67,9 @@ class ONNXExporterTester(unittest.TestCase):
torch.testing.assert_allclose(outputs[i], ort_outs[i], rtol=1e-03, atol=1e-05) torch.testing.assert_allclose(outputs[i], ort_outs[i], rtol=1e-03, atol=1e-05)
except AssertionError as error: except AssertionError as error:
if tolerate_small_mismatch: if tolerate_small_mismatch:
assert ("(0.00%)" in str(error)), str(error) self.assertIn("(0.00%)", str(error), str(error))
else: else:
assert False, str(error) raise
def test_nms(self): def test_nms(self):
boxes = torch.rand(5, 4) boxes = torch.rand(5, 4)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment