Skip to content

Commit d409c11

Browse files
frgfmfmassa
authored andcommitted
test: Updated asserts in test_onnx (pytorch#1497)
* test: Updated asserts in test_onnx Updated all raw asserts to corresponding unittest.TestCase.assert. See pytorch#1483 * test: Refactored AssertionError Opted for cleaner raise to avoid error type casting and string conversion
1 parent 355e9d2 commit d409c11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/test_onnx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def to_numpy(tensor):
6767
torch.testing.assert_allclose(outputs[i], ort_outs[i], rtol=1e-03, atol=1e-05)
6868
except AssertionError as error:
6969
if tolerate_small_mismatch:
70-
assert ("(0.00%)" in str(error)), str(error)
70+
self.assertIn("(0.00%)", str(error), str(error))
7171
else:
72-
assert False, str(error)
72+
raise
7373

7474
def test_nms(self):
7575
boxes = torch.rand(5, 4)

0 commit comments

Comments
 (0)