@@ -61,8 +61,9 @@ def test_solver_errors_all_functions(algorithm: str) -> None:
6161
6262
6363@pytest .mark .skipif (not evalica .PYO3_AVAILABLE , reason = "Rust extension is not available" )
64- def test_version_consistency () -> None :
65- assert evalica .__version__ == evalica ._brzo .__version__ # noqa: SLF001
64+ def test_brzo_has_version () -> None :
65+ assert hasattr (evalica ._brzo , "__version__" ) # noqa: SLF001
66+ assert isinstance (evalica ._brzo .__version__ , str ) # noqa: SLF001
6667
6768
6869def test_exports () -> None :
@@ -116,3 +117,16 @@ def test_pairwise_scores_solver_error(monkeypatch: pytest.MonkeyPatch) -> None:
116117 monkeypatch .setattr (evalica , "PYO3_AVAILABLE" , False )
117118 with pytest .raises (evalica .SolverError ):
118119 evalica .pairwise_scores (np .array ([1.0 , 2.0 , 3.0 ]), solver = "pyo3" )
120+
121+
122+ def test_version_without_brzo () -> None :
123+ with unittest .mock .patch .dict (sys .modules , {"evalica._brzo" : None }):
124+ sys .modules .pop ("evalica" , None )
125+
126+ with warnings .catch_warnings ():
127+ warnings .simplefilter ("ignore" , category = RuntimeWarning )
128+ import evalica # noqa: PLC0415
129+
130+ assert not evalica .PYO3_AVAILABLE
131+ assert isinstance (evalica .__version__ , str )
132+ assert len (evalica .__version__ ) > 0
0 commit comments