Commit a49eed00 authored by André Anjos's avatar André Anjos 💬

[test] Fix precision test to be a bit softer on floating-point comparisons

parent ef7bb2ed
Pipeline #35970 failed with stage
in 9 minutes
......@@ -116,7 +116,7 @@ def test_training():
previous = Machine(TEST_MACHINE_NO_PROBS)
nose.tools.eq_(machine.machine_type, previous.machine_type)
nose.tools.eq_(machine.kernel_type, previous.kernel_type)
nose.tools.eq_(machine.gamma, previous.gamma)
assert numpy.isclose(machine.gamma, previous.gamma)
nose.tools.eq_(machine.shape, previous.shape)
assert numpy.all(abs(machine.input_subtract - previous.input_subtract) < 1e-8)
assert numpy.all(abs(machine.input_divide - previous.input_divide) < 1e-8)
......@@ -150,7 +150,7 @@ def test_training_with_probability():
previous = Machine(HEART_MACHINE)
nose.tools.eq_(machine.machine_type, previous.machine_type)
nose.tools.eq_(machine.kernel_type, previous.kernel_type)
nose.tools.eq_(machine.gamma, previous.gamma)
assert numpy.isclose(machine.gamma, previous.gamma)
nose.tools.eq_(machine.shape, previous.shape)
assert numpy.all(abs(machine.input_subtract - previous.input_subtract) < 1e-8)
assert numpy.all(abs(machine.input_divide - previous.input_divide) < 1e-8)
......@@ -198,7 +198,7 @@ def test_training_one_class():
previous = Machine(TEST_MACHINE_ONE_CLASS)
nose.tools.eq_(machine.machine_type, previous.machine_type)
nose.tools.eq_(machine.kernel_type, previous.kernel_type)
nose.tools.eq_(machine.gamma, previous.gamma)
assert numpy.isclose(machine.gamma, previous.gamma)
nose.tools.eq_(machine.shape, previous.shape)
assert numpy.all(abs(machine.input_subtract - previous.input_subtract) < 1e-8)
assert numpy.all(abs(machine.input_divide - previous.input_divide) < 1e-8)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment