diff --git a/tests/openface_api_tests.py b/tests/openface_api_tests.py index cb4dde748..5f68c6780 100644 --- a/tests/openface_api_tests.py +++ b/tests/openface_api_tests.py @@ -19,6 +19,7 @@ import os import numpy as np +import numpy.testing as npt np.set_printoptions(precision=2) import scipy @@ -63,5 +64,4 @@ def test_pipeline(): rep = net.forward(alignedFace) cosDist = scipy.spatial.distance.cosine(rep, np.ones(128)) - print(cosDist) - assert np.isclose(cosDist, 0.938840385931) + npt.assert_almost_equal(cosDist, 0.938840385931) diff --git a/tests/openface_batch_represent_tests.py b/tests/openface_batch_represent_tests.py index e1cd261bf..662a29b79 100644 --- a/tests/openface_batch_represent_tests.py +++ b/tests/openface_batch_represent_tests.py @@ -20,6 +20,7 @@ import tempfile import numpy as np +import numpy.testing as npt np.set_printoptions(precision=2) import pandas as pd import scipy @@ -86,6 +87,6 @@ def test_batch_represent(): cosDist = scipy.spatial.distance.cosine(brody1, brody2) print('cosDist:', cosDist) - assert np.isclose(cosDist, 0.1568, atol=1e-4) + npt.assert_almost_equal(cosDist, 0.1568, decimal=4) shutil.rmtree(workDir)