Skip to content

Commit b9a2356

Browse files
committed
[Test] unittest.TestCase.assertAlmostEqual rounds the figure, which is not what is intended. Intead, use a method that evaluates sigfig.
1 parent 7a4dd3f commit b9a2356

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ar_track_alvar/test/test_ar.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3535
# POSSIBILITY OF SUCH DAMAGE.
3636

37+
import numpy
3738
import math
3839
import unittest
3940

@@ -91,10 +92,12 @@ def test_markers(self):
9192
continue
9293
# Compare each translation element (x, y, z)
9394
for v_ret, v_expected in zip(trans, tf_expected[i][0]):
94-
self.assertAlmostEqual(v_ret, v_expected, 2)
95+
numpy.testing.assert_approx_equal(
96+
v_ret, v_expected, significant=2)
9597
# Compare each orientation element (x, y, z, w)
9698
for v_ret, v_expected in zip(rot, tf_expected[i][1]):
97-
self.assertAlmostEqual(v_ret, v_expected, 2)
99+
numpy.testing.assert_approx_equal(
100+
v_ret, v_expected, significant=2)
98101

99102
if __name__ == '__main__':
100103
import rostest

0 commit comments

Comments
 (0)