@@ -139,23 +139,19 @@ function test_errors_DeleteNotAllowed()
139139 try
140140 MOI. delete (model, vi)
141141 catch err
142- @test sprint (showerror, err) ==
143- " $(MOI. DeleteNotAllowed{typeof (vi)}) : Deleting the index $vi " *
144- " cannot be performed. You may want to use a `CachingOptimizer` " *
145- " in `AUTOMATIC` mode or you may need to call `reset_optimizer` " *
146- " before doing this operation if the `CachingOptimizer` is in " *
147- " `MANUAL` mode."
142+ contents = sprint (showerror, err)
143+ @test occursin (" $(MOI. DeleteNotAllowed{typeof (vi)}) " , contents)
144+ @test occursin (" Deleting the index $vi " , contents)
145+ @test occursin (" ## Fixing this error" , contents)
148146 end
149147 @test_throws MOI. DeleteNotAllowed{typeof (ci)} MOI. delete (model, ci)
150148 try
151149 MOI. delete (model, ci)
152150 catch err
153- @test sprint (showerror, err) ==
154- " $(MOI. DeleteNotAllowed{typeof (ci)}) : Deleting the index $ci " *
155- " cannot be performed. You may want to use a `CachingOptimizer` " *
156- " in `AUTOMATIC` mode or you may need to call `reset_optimizer` " *
157- " before doing this operation if the `CachingOptimizer` is in " *
158- " `MANUAL` mode."
151+ contents = sprint (showerror, err)
152+ @test occursin (" $(MOI. DeleteNotAllowed{typeof (ci)}) " , contents)
153+ @test occursin (" Deleting the index $ci " , contents)
154+ @test occursin (" ## Fixing this error" , contents)
159155 end
160156 return
161157end
@@ -244,14 +240,11 @@ function test_errors_ModifyNotAllowed_constraint()
244240 change = MOI. ScalarConstantChange (1.0 )
245241 err = MOI. ModifyConstraintNotAllowed (ci, change)
246242 @test_throws err MOI. modify (model, ci, change)
247- @test sprint (showerror, err) ==
248- " $(MOI. ModifyConstraintNotAllowed{MOI. VariableIndex,MOI. EqualTo{Float64},MOI. ScalarConstantChange{Float64}}) :" *
249- " Modifying the constraints $(MOI. ConstraintIndex {MOI.VariableIndex,MOI.EqualTo{Float64}} (1 )) " *
250- " with MathOptInterface.ScalarConstantChange{Float64}(1.0) cannot" *
251- " be performed. You may want to use a `CachingOptimizer` in" *
252- " `AUTOMATIC` mode or you may need to call `reset_optimizer`" *
253- " before doing this operation if the `CachingOptimizer` is in" *
254- " `MANUAL` mode."
243+ contents = sprint (showerror, err)
244+ @test occursin (" $(typeof (err)) :" contents)
245+ @test occursin (" Modifying the constraints $ci " , contents)
246+ @test occursin (" ## Fixing this error" , contents)
247+ return
255248end
256249
257250function test_errors_ModifyNotAllowed_objective ()
@@ -260,13 +253,11 @@ function test_errors_ModifyNotAllowed_objective()
260253 attr = MOI. ObjectiveFunction {MOI.VariableIndex} ()
261254 err = MOI. ModifyObjectiveNotAllowed (change)
262255 @test_throws err MOI. modify (model, attr, change)
263- @test sprint (showerror, err) ==
264- " $(MOI. ModifyObjectiveNotAllowed{MOI. ScalarConstantChange{Float64}}) :" *
265- " Modifying the objective function with $(MOI. ScalarConstantChange {Float64} (1.0 )) " *
266- " cannot be performed. You may want to use a `CachingOptimizer`" *
267- " in `AUTOMATIC` mode or you may need to call `reset_optimizer`" *
268- " before doing this operation if the `CachingOptimizer` is in" *
269- " `MANUAL` mode."
256+ contents = sprint (showerror, err)
257+ @test occursin (" $(typeof (err)) :" contents)
258+ @test occursin (" Modifying the objective function with $change " , contents)
259+ @test occursin (" ## Fixing this error" , contents)
260+ return
270261end
271262
272263function test_errors_show_SetAttributeNotAllowed ()
@@ -352,11 +343,10 @@ function test_get_fallback_error()
352343 MOI. get (model, MOI. SolveTimeSec ()),
353344 )
354345 err = MOI. GetAttributeNotAllowed (MOI. SolveTimeSec (), " " )
355- @test sprint (showerror, err) ==
356- " $(typeof (err)) : Getting attribute $(MOI. SolveTimeSec ()) cannot be " *
357- " performed. You may want to use a `CachingOptimizer` in " *
358- " `AUTOMATIC` mode or you may need to call `reset_optimizer` before " *
359- " doing this operation if the `CachingOptimizer` is in `MANUAL` mode."
346+ contents = sprint (showerror, err)
347+ @test occursin (" $(typeof (err)) :" , contents)
348+ @test occursin (" Getting attribute $(MOI. SolveTimeSec ()) " , contents)
349+ @test occursin (" ## Fixing this error" , contents)
360350 return
361351end
362352
0 commit comments