@@ -139,23 +139,19 @@ function test_errors_DeleteNotAllowed()
139
139
try
140
140
MOI. delete (model, vi)
141
141
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)
148
146
end
149
147
@test_throws MOI. DeleteNotAllowed{typeof (ci)} MOI. delete (model, ci)
150
148
try
151
149
MOI. delete (model, ci)
152
150
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)
159
155
end
160
156
return
161
157
end
@@ -244,14 +240,11 @@ function test_errors_ModifyNotAllowed_constraint()
244
240
change = MOI. ScalarConstantChange (1.0 )
245
241
err = MOI. ModifyConstraintNotAllowed (ci, change)
246
242
@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
255
248
end
256
249
257
250
function test_errors_ModifyNotAllowed_objective ()
@@ -260,13 +253,11 @@ function test_errors_ModifyNotAllowed_objective()
260
253
attr = MOI. ObjectiveFunction {MOI.VariableIndex} ()
261
254
err = MOI. ModifyObjectiveNotAllowed (change)
262
255
@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
270
261
end
271
262
272
263
function test_errors_show_SetAttributeNotAllowed ()
@@ -352,11 +343,10 @@ function test_get_fallback_error()
352
343
MOI. get (model, MOI. SolveTimeSec ()),
353
344
)
354
345
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)
360
350
return
361
351
end
362
352
0 commit comments