Skip to content

Commit

Permalink
np.testing.assert_allclose integration
Browse files Browse the repository at this point in the history
  • Loading branch information
dhuvik committed Mar 12, 2024
1 parent 1b35ab9 commit c57e9a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 0 additions & 6 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ def eq_(x, y, msg=None):
else:
assert x == y, msg

def approx_(x, y, tol=1e-6, msg=None):
if msg is None:
assert abs(x - y) < tol
else:
assert abs(x - y) < tol, msg

def neq_(x, y, msg=None):
if msg is None:
assert x != y
Expand Down
4 changes: 2 additions & 2 deletions tests/test_netmhc_stabpan.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .common import approx_
import numpy as np
from mhctools import NetMHCstabpan


Expand Down Expand Up @@ -57,6 +57,6 @@ def test_netmhc_stabpan_accuracy():
for i, (expected, actual) in enumerate(zip(web_server_predictions, stability_predictions)):
# Check to make sure that the stability predictions are within 0.01 of the webserver values.
# This could be the result of different versions of dependencies or the nature of the ANN itself.
approx_(expected, actual, tol=0.01, msg="Peptide %d: expected %f but got %f" % (i, expected, actual))
np.testing.assert_allclose(expected, actual, atol=0.01, error_msg="Peptide %d: expected %f but got %f" % (i, expected, actual))


0 comments on commit c57e9a6

Please sign in to comment.