Update tests to use numpy.testing

This commit is contained in:
Brandon Amos 2016-10-15 18:22:40 -04:00
parent 1267e1abb3
commit 882109c141
2 changed files with 4 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import cv2
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)

View File

@ -20,6 +20,7 @@ import shutil
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)