8000 compare floats as almost equal · python-control/python-control@089ca21 · GitHub
[go: up one dir, main page]

Skip to content

Commit 089ca21

Browse files
committed
compare floats as almost equal
1 parent 2f343be commit 089ca21

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

control/tests/flatsys_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -693,9 +693,9 @@ def test_response(self, xf, uf, Tf):
693693

694694
# Recompute using response()
695695
response = traj.response(T, squeeze=False)
696-
np.testing.assert_equal(T, response.time)
697-
np.testing.assert_equal(u, response.inputs)
698-
np.testing.assert_equal(x, response.states)
696+
np.testing.assert_array_almost_equal(T, response.time)
697+
np.testing.assert_array_almost_equal(u, response.inputs)
698+
np.testing.assert_array_almost_equal(x, response.states)
699699

700700
@pytest.mark.parametrize(
701701
"basis",
@@ -713,7 +713,7 @@ def test_basis_class(self, basis):
713713
for j in range(basis.N):
714714
coefs = np.zeros(basis.N)
715715
8000 coefs[j] = 1
716-
np.testing.assert_equal(
716+
np.testing.assert_array_almost_equal(
717717
basis.eval(coefs, timepts),
718718
basis.eval_deriv(j, 0, timepts))
719719
else:
@@ -722,7 +722,7 @@ def test_basis_class(self, basis):
722722
for j in range(basis.var_ncoefs(i)):
723723
coefs = np.zeros(basis.var_ncoefs(i))
724724
coefs[j] = 1
725-
np.testing.assert_equal(
725+
np.testing.assert_array_almost_equal(
726726
basis.eval(coefs, timepts, var=i),
727727
basis.eval_deriv(j, 0, timepts, var=i))
728728

@@ -732,7 +732,7 @@ def test_basis_class(self, basis):
732732
for j in range(basis.var_ncoefs(i)):
733733
coefs = np.zeros(basis.N)
734734
coefs[offset] = 1
735-
np.testing.assert_equal(
735+
np.testing.assert_array_almost_equal(
736736
basis.eval(coefs, timepts)[i],
737737
basis.eval_deriv(j, 0, timepts, var=i))
738738
offset += 1

0 commit comments

Comments
 (0)
0