Skip to content

Commit c57e9a6

Browse files
committed
np.testing.assert_allclose integration
1 parent 1b35ab9 commit c57e9a6

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

tests/common.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ def eq_(x, y, msg=None):
2424
else:
2525
assert x == y, msg
2626

27-
def approx_(x, y, tol=1e-6, msg=None):
28-
if msg is None:
29-
assert abs(x - y) < tol
30-
else:
31-
assert abs(x - y) < tol, msg
32-
3327
def neq_(x, y, msg=None):
3428
if msg is None:
3529
assert x != y

tests/test_netmhc_stabpan.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License.
1212

13-
from .common import approx_
13+
import numpy as np
1414
from mhctools import NetMHCstabpan
1515

1616

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

6262

0 commit comments

Comments
 (0)