Change assertTrue to np.testing.assert_array_less.

This gives a more informative error message on failure, e.g. in https://github.com/conda-forge/mujoco-feedstock/pull/31#issuecomment-1770195171

PiperOrigin-RevId: 574879703
Change-Id: I1936c16264b00d6f80c4817d982b0ab4ab6d4b5d
This commit is contained in:
Saran Tunyasuvunakool
2023-10-19 08:26:25 -07:00
committed by Copybara-Service
parent 9393c690d4
commit 2970a2575d
+2 -2
View File
@@ -303,7 +303,7 @@ class ConvexTest(absltest.TestCase):
c = dx.contact
self.assertEqual(c.pos.shape[0], 4)
self.assertTrue((c.dist < 0).all())
np.testing.assert_array_less(c.dist, 0)
np.testing.assert_array_almost_equal(c.pos[:, 2], np.array([0.39] * 4), 2)
np.testing.assert_array_almost_equal(
c.frame[:, 0, :], np.array([[0.0, 0.0, 1.0]] * 4)
@@ -375,7 +375,7 @@ class ConvexTest(absltest.TestCase):
# Only one contact point for an edge contact.
self.assertLess(c.dist[0], 0)
self.assertTrue((c.dist[1:] > 0).all())
np.testing.assert_array_less(0, c.dist[1:])
np.testing.assert_array_almost_equal(c.frame[0, 0], np.array([0, 0, 1]))