Skip to content

Improve test assertions to show actual values on failure - #1616

Merged
mthrok merged 1 commit into
mainfrom
fix-tests
Aug 26, 2026
Merged

Improve test assertions to show actual values on failure#1616
mthrok merged 1 commit into
mainfrom
fix-tests

Conversation

@mthrok

@mthrok mthrok commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Replace assertion patterns that don't show values on failure with NumPy and PyTorch testing utilities.

Migrate from self.assertTrue(np.all(...)) and self.assertTrue(torch.allclose(...)) to np.testing.assert_array_equal, np.testing.assert_array_compare, np.testing.assert_allclose, and torch.testing.assert_close. These testing utilities automatically include summaries of actual vs expected values in their error messages, making test failures much easier to debug.

Replace assertion patterns that don't show values on failure with NumPy and PyTorch testing utilities.

Migrate from `self.assertTrue(np.all(...))` and `self.assertTrue(torch.allclose(...))` to `np.testing.assert_array_equal`, `np.testing.assert_array_compare`, `np.testing.assert_allclose`, and `torch.testing.assert_close`. These testing utilities automatically include summaries of actual vs expected values in their error messages, making test failures much easier to debug.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 25, 2026
@meta-codesync

meta-codesync Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D117439936. (Because this pull request was imported automatically, there will not be any future comments.)

@mthrok
mthrok marked this pull request as ready for review August 26, 2026 00:01
@mthrok
mthrok merged commit 9d7ed67 into main Aug 26, 2026
108 checks passed
@mthrok
mthrok deleted the fix-tests branch August 26, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant