File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import sys
4+ import unittest .mock
35from functools import partial
46from typing import TYPE_CHECKING , Literal
57
@@ -371,3 +373,18 @@ def custom_abs_diff(left: float, right: float) -> float:
371373 assert result_pyo3 .alpha == pytest .approx (result_naive .alpha )
372374 assert result_pyo3 .observed == pytest .approx (result_naive .observed )
373375 assert result_pyo3 .expected == pytest .approx (result_naive .expected )
376+
377+
378+ def test_alpha_solver_error () -> None :
379+ with unittest .mock .patch .dict (sys .modules , {"evalica._brzo" : None }):
380+ sys .modules .pop ("evalica" , None )
381+
382+ with pytest .warns ():
383+ import evalica # noqa: PLC0415
384+
385+ assert not evalica .PYO3_AVAILABLE
386+
387+ data = pd .DataFrame ([[1 , 2 ], [2 , 3 ]])
388+
389+ with pytest .raises (evalica .SolverError , match = "The 'pyo3' solver is not available" ):
390+ evalica .alpha (data , solver = "pyo3" )
You can’t perform that action at this time.
0 commit comments