Skip to content

Commit

Permalink
[Test] unittest.TestCase.assertAlmostEqual rounds the figure, which i…
Browse files Browse the repository at this point in the history
…s not what is intended. Intead, use a method that evaluates sigfig.
  • Loading branch information
130s committed May 30, 2017
1 parent 7a4dd3f commit b9a2356
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ar_track_alvar/test/test_ar.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

import numpy
import math
import unittest

Expand Down Expand Up @@ -91,10 +92,12 @@ def test_markers(self):
continue
# Compare each translation element (x, y, z)
for v_ret, v_expected in zip(trans, tf_expected[i][0]):
self.assertAlmostEqual(v_ret, v_expected, 2)
numpy.testing.assert_approx_equal(
v_ret, v_expected, significant=2)
# Compare each orientation element (x, y, z, w)
for v_ret, v_expected in zip(rot, tf_expected[i][1]):
self.assertAlmostEqual(v_ret, v_expected, 2)
numpy.testing.assert_approx_equal(
v_ret, v_expected, significant=2)

if __name__ == '__main__':
import rostest
Expand Down

0 comments on commit b9a2356

Please sign in to comment.