Skip to content

Commit 311923e

Browse files
committed
Fix test for gear and multirotor - part2
1 parent 5b09f16 commit 311923e

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

ross/gear_element.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ class Mesh:
913913
... )
914914
>>> mesh = Mesh(driving, driven)
915915
>>> mesh.stiffness # doctest : +ELLIPSIS
916-
429787128.434...
916+
429787095.100...
917917
"""
918918

919919
def __init__(

ross/multi_rotor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class MultiRotor(Rotor):
108108
... )
109109
>>> modal = multi_rotor.run_modal(speed=0)
110110
>>> modal.wd[0] # doctest: +ELLIPSIS
111-
74.163...
111+
74.160...
112112
"""
113113

114114
@check_units

ross/tests/test_gear_element.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import pytest
33
from copy import deepcopy
4-
from numpy.testing import assert_almost_equal
4+
from numpy.testing import assert_allclose
55

66
from ross.units import Q_
77
from ross.materials import Material, steel
@@ -38,7 +38,7 @@ def test_mass_matrix_gear(gear):
3838
[ 0., 0., 0., 0., 0., 113.9]])
3939
# fmt: on
4040

41-
assert_almost_equal(gear.M(), Mg, decimal=5)
41+
assert_allclose(gear.M(), Mg, rtol=1e-6, atol=1e-5)
4242

4343

4444
def test_gyroscopic_matrix_gear(gear):
@@ -51,7 +51,7 @@ def test_gyroscopic_matrix_gear(gear):
5151
[0., 0., 0., 0., 0., 0.]])
5252
# fmt: on
5353

54-
assert_almost_equal(gear.G(), Gg, decimal=5)
54+
assert_allclose(gear.G(), Gg, rtol=1e-6, atol=1e-5)
5555

5656

5757
@pytest.fixture
@@ -114,7 +114,7 @@ def test_mass_matrix_gear_tvms(gear_tvms):
114114
[ 0., 0., 0., 0., 0., 0.00360]])
115115
# fmt: on
116116

117-
assert_almost_equal(gear_tvms.M(), Mgt, decimal=5)
117+
assert_allclose(gear_tvms.M(), Mgt, rtol=1e-6, atol=1e-5)
118118

119119

120120
def test_gyroscopic_matrix_gear_tvms(gear_tvms):
@@ -127,7 +127,7 @@ def test_gyroscopic_matrix_gear_tvms(gear_tvms):
127127
[0., 0., 0., 0., 0., 0.]])
128128
# fmt: on
129129

130-
assert_almost_equal(gear_tvms.G(), Ggt, decimal=5)
130+
assert_allclose(gear_tvms.G(), Ggt, rtol=1e-6, atol=1e-5)
131131

132132

133133
@pytest.fixture

ross/tests/test_multi_rotor.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import pytest
33
from copy import deepcopy
4-
from numpy.testing import assert_almost_equal
4+
from numpy.testing import assert_allclose
55

66
import ross as rs
77

@@ -125,8 +125,10 @@ def multi_rotor():
125125

126126

127127
def test_mesh(multi_rotor):
128-
assert multi_rotor.mesh.contact_ratio == 1.6377334309511222
129-
assert multi_rotor.mesh.stiffness == 1937234387.18946
128+
assert_allclose(
129+
multi_rotor.mesh.contact_ratio, 1.6377334309511222, rtol=1e-6, atol=1e-5
130+
)
131+
assert_allclose(multi_rotor.mesh.stiffness, 1937234387.18946, rtol=1e-6, atol=1e-5)
130132

131133

132134
def test_coupling_matrix_gear(multi_rotor):
@@ -303,4 +305,6 @@ def test_coupling_matrix_gear(multi_rotor):
303305
]
304306
)
305307

306-
assert_almost_equal(multi_rotor.coupling_matrix(), coupling_matrix, decimal=5)
308+
assert_allclose(
309+
multi_rotor.coupling_matrix(), coupling_matrix, rtol=1e-6, atol=1e-5
310+
)

0 commit comments

Comments
 (0)