diff --git a/tests/common.py b/tests/common.py index 0fe36f1f..baa5af39 100644 --- a/tests/common.py +++ b/tests/common.py @@ -64,8 +64,13 @@ def scorer_tester(scorer, s1, s2, **kwargs): assert pytest.approx(score1) == extract_iter_res1[0][1] assert pytest.approx(score1) == extract_iter_res2[0][1] + try: + import numpy as np + except Exception: + np = None + # todo this should be able to handle None similar to the original scorer - if not is_none(s1) and not is_none(s2): + if not is_none(s1) and not is_none(s2) and np is not None: score6 = process_cpp.cdist([s1], [s2], scorer=scorer, **kwargs)[0][0] score7 = process_py.cdist([s1], [s2], scorer=scorer, **kwargs)[0][0] assert pytest.approx(score1) == score6