3939 DWI ,
4040)
4141from nifreeze .model ._dipy import GaussianProcessModel
42- from nifreeze .model .base import UNSUPPORTED_MODEL_ERROR_MSG , mask_absence_warn_msg
42+ from nifreeze .model .base import (
43+ MASK_ABSENCE_WARN_MSG ,
44+ PREDICTED_MAP_ERROR_MSG ,
45+ UNSUPPORTED_MODEL_ERROR_MSG ,
46+ )
4347from nifreeze .testing import simulations as _sim
4448
4549
@@ -60,6 +64,12 @@ class DummyDataset:
6064 pass
6165
6266
67+ class DummyDatasetNoRef :
68+ def __init__ (self ):
69+ # No reference or bzero here to trigger TrivialModel error
70+ self .brainmask = np .ones ((1 , 1 , 1 , 1 )).astype (bool )
71+
72+
6373def test_base_model ():
6474 from nifreeze .model .base import BaseModel
6575
@@ -78,8 +88,8 @@ def test_trivial_model(request, use_mask):
7888 rng = request .node .rng
7989
8090 # Should not allow initialization without an oracle
81- with pytest .raises (TypeError ):
82- model .TrivialModel () # type: ignore[call-arg]
91+ with pytest .raises (TypeError , match = PREDICTED_MAP_ERROR_MSG ):
92+ model .TrivialModel (DummyDatasetNoRef ())
8393
8494 size = (2 , 2 , 2 )
8595 mask = None
@@ -88,7 +98,7 @@ def test_trivial_model(request, use_mask):
8898 mask = np .ones (size , dtype = bool )
8999 context = contextlib .nullcontext ()
90100 else :
91- context = pytest .warns (UserWarning , match = mask_absence_warn_msg )
101+ context = pytest .warns (UserWarning , match = MASK_ABSENCE_WARN_MSG )
92102
93103 _S0 = rng .normal (size = size )
94104
0 commit comments