Skip to content

Commit 9a9e874

Browse files
committed
Update
1 parent 42dab1f commit 9a9e874

5 files changed

Lines changed: 63 additions & 62 deletions

File tree

src/attributes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ function Base.showerror(io::IO, err::OptimizeInProgress)
12731273
This error occurs when you try to query an unsupported attribute from \
12741274
inside a callback. Consult the solver's documentation to learn which \
12751275
attributes may be queried inside a callback.
1276-
"""
1276+
""",
12771277
)
12781278
end
12791279

test/Bridges/General/test_lazy_bridge_optimizer.jl

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,17 +1772,18 @@ function test_UnsupportedConstraint_when_it_cannot_be_bridged()
17721772
mock = MOI.Utilities.MockOptimizer(NoRSOCModel{Float64}())
17731773
bridged_mock = MOI.Bridges.LazyBridgeOptimizer(mock)
17741774
x = MOI.add_variables(bridged_mock, 4)
1775-
err = MOI.UnsupportedConstraint{
1776-
MOI.VectorOfVariables,
1777-
MOI.RotatedSecondOrderCone,
1778-
}()
1779-
@test_throws err begin
1775+
@test_throws(
1776+
MOI.UnsupportedConstraint{
1777+
MOI.VectorOfVariables,
1778+
MOI.RotatedSecondOrderCone,
1779+
},
17801780
MOI.add_constraint(
17811781
bridged_mock,
17821782
MOI.VectorOfVariables(x),
17831783
MOI.RotatedSecondOrderCone(4),
1784-
)
1785-
end
1784+
),
1785+
)
1786+
return
17861787
end
17871788

17881789
function test_MOI_runtests_No_RSOCModel()
@@ -1839,17 +1840,17 @@ function test_bridge_selection()
18391840
MOI.LogDetConeTriangle,
18401841
))
18411842
x = MOI.add_variables(bridged_mock, 3)
1842-
err = MOI.UnsupportedConstraint{
1843-
MOI.VectorAffineFunction{Float64},
1844-
MOI.LogDetConeTriangle,
1845-
}()
1846-
@test_throws err begin
1843+
@test_throws(
1844+
MOI.UnsupportedConstraint{
1845+
MOI.VectorAffineFunction{Float64},
1846+
MOI.LogDetConeTriangle,
1847+
},
18471848
MOI.Bridges.bridge_type(
18481849
bridged_mock,
18491850
MOI.VectorAffineFunction{Float64},
18501851
MOI.LogDetConeTriangle,
1851-
)
1852-
end
1852+
),
1853+
)
18531854
c = MOI.add_constraint(
18541855
bridged_mock,
18551856
MOI.VectorOfVariables(x),

test/General/test_attributes.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,15 @@ end
392392

393393
function test_showerror_OptimizeInProgress()
394394
err = MOI.OptimizeInProgress(MOI.VariablePrimal())
395-
@test sprint(showerror, err) ==
396-
"""
397-
Unable to get the attribute MathOptInterface.VariablePrimal(1) \
398-
because `MOI.optimize!` in progress.
399-
400-
This error occurs when you try to query an unsupported attribute from \
401-
inside a callback. Consult the solver's documentation to learn which \
402-
attributes may be queried inside a callback.
403-
"""
395+
ret = """
396+
Unable to get the attribute MathOptInterface.VariablePrimal(1) \
397+
because `MOI.optimize!` in progress.
398+
399+
This error occurs when you try to query an unsupported attribute from \
400+
inside a callback. Consult the solver's documentation to learn which \
401+
attributes may be queried inside a callback.
402+
"""
403+
@test sprint(showerror, err) == ret
404404
return
405405
end
406406

test/General/test_constraints.jl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@ function test_LowerBoundAlreadySet_error()
4646
S2 = MOI.Interval{Int}
4747
err = MOI.LowerBoundAlreadySet{S1,S2}(x)
4848
@test err isa Exception
49-
@test sprint(showerror, err) ==
50-
"""
51-
LowerBoundAlreadySet{
52-
$S1,
53-
$S2,
54-
}
49+
ret = """
50+
LowerBoundAlreadySet{
51+
$S1,
52+
$S2,
53+
}
5554
56-
You cannot add a `VariableIndex`-in-`$(S2)` constraint for variable \
57-
$(x) because a `VariableIndex`-in-`$(S1)` constraint was already set \
58-
for this variable and both constraints define a lower bound.
59-
"""
55+
You cannot add a `VariableIndex`-in-`$(S2)` constraint for variable \
56+
$(x) because a `VariableIndex`-in-`$(S1)` constraint was already set \
57+
for this variable and both constraints define a lower bound.
58+
"""
59+
@test sprint(showerror, err) == ret
6060
return
6161
end
6262

@@ -66,17 +66,17 @@ function test_UpperBoundAlreadySet_error()
6666
S2 = MOI.Interval{Int}
6767
err = MOI.UpperBoundAlreadySet{S1,S2}(x)
6868
@test err isa Exception
69-
@test sprint(showerror, err) ==
70-
"""
71-
UpperBoundAlreadySet{
72-
$S1,
73-
$S2,
74-
}
69+
ret = """
70+
UpperBoundAlreadySet{
71+
$S1,
72+
$S2,
73+
}
7574
76-
You cannot add a `VariableIndex`-in-`$(S2)` constraint for variable \
77-
$(x) because a `VariableIndex`-in-`$(S1)` constraint was already set \
78-
for this variable and both constraints define an upper bound.
79-
"""
75+
You cannot add a `VariableIndex`-in-`$(S2)` constraint for variable \
76+
$(x) because a `VariableIndex`-in-`$(S1)` constraint was already set \
77+
for this variable and both constraints define an upper bound.
78+
"""
79+
@test sprint(showerror, err) == ret
8080
return
8181
end
8282

test/General/test_errors.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function test_errors_UnsupportedConstraint()
6666
MOI.UnsupportedConstraint,
6767
MOI.add_constraint(model, vi, MOI.EqualTo(0)),
6868
)
69-
msg = """
69+
ret = """
7070
UnsupportedConstraint{
7171
$(MOI.VariableIndex),
7272
$(MOI.EqualTo{Int}),
@@ -79,7 +79,7 @@ function test_errors_UnsupportedConstraint()
7979
try
8080
MOI.add_constraint(model, vi, MOI.EqualTo(0))
8181
catch err
82-
@test sprint(showerror, err) == msg
82+
@test sprint(showerror, err) == ret
8383
end
8484
return
8585
end
@@ -299,23 +299,23 @@ end
299299

300300
function test_errors_ResultIndexBoundsError()
301301
err = MOI.ResultIndexBoundsError(MOI.VariablePrimal(1), 0)
302-
@test sprint(showerror, err) ==
303-
"""
304-
Result index of attribute MathOptInterface.VariablePrimal(1) is out of bounds.
302+
ret = """
303+
Result index of attribute MathOptInterface.VariablePrimal(1) is out of bounds.
305304
306-
There are currently 0 solution(s) in the model.
307-
"""
305+
There are currently 0 solution(s) in the model.
306+
"""
307+
@test sprint(showerror, err) == ret
308308
return
309309
end
310310

311311
function test_errors_ConflictIndexBoundsError()
312312
err = MOI.ConflictIndexBoundsError(MOI.ConstraintConflictStatus(1), 0)
313-
@test sprint(showerror, err) ==
314-
"""
315-
Conflict index of attribute MathOptInterface.ConstraintConflictStatus(1) is out of bounds.
313+
ret = """
314+
Conflict index of attribute MathOptInterface.ConstraintConflictStatus(1) is out of bounds.
316315
317-
There are currently 0 conflict(s) in the model.
318-
"""
316+
There are currently 0 conflict(s) in the model.
317+
"""
318+
@test sprint(showerror, err) == ret
319319
return
320320
end
321321

@@ -396,13 +396,13 @@ end
396396

397397
function test_showerror_InvalidIndex()
398398
x = MOI.VariableIndex(1)
399-
@test sprint(showerror, MOI.InvalidIndex(x)) ==
400-
"""
401-
The index $x is invalid.
399+
err = """
400+
The index $x is invalid.
402401
403-
An index becomes invalid after it has been deleted. Alternatively, this \
404-
error might mean that you have re-used the index from a different model.
405-
"""
402+
An index becomes invalid after it has been deleted. Alternatively, this \
403+
error might mean that you have re-used the index from a different model.
404+
"""
405+
@test sprint(showerror, MOI.InvalidIndex(x)) == err
406406
return
407407
end
408408

0 commit comments

Comments
 (0)