Skip to content

Commit

Permalink
fix(test_from_matrix): assume max precision
Browse files Browse the repository at this point in the history
When converting to matrix back and forth, coordinates appear to be
rounded to a precision of 1e-8. This causes sporadic failures in said
test.

For this test it should be assumed that the coordinates of arr can be
described with said precision.
  • Loading branch information
MarcoMiretti committed Sep 9, 2020
1 parent 649d47b commit a66d248
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_quaternion.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ def test_matrix(self, arr):
@given(ANY_QUATERNION)
def test_from_matrix(self, arr):
assume(GeneralQuaternion(*arr).norm() > DEFAULT_TOLERANCE)
EXP = - int(np.log10(DEFAULT_TOLERANCE))
for coordinate in Quaternion(*arr).coordinates:
assume(coordinate == round(coordinate, EXP))
q = Quaternion(*arr)
assert q.from_matrix(q.matrix) == q

Expand Down

0 comments on commit a66d248

Please sign in to comment.