Skip to content

Commit d72027c

Browse files
authored
Fix and add test for throwing UnsupportedSubmittable (#1393)
1 parent 198d3fc commit d72027c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/attributes.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,12 @@ function submit(model::ModelLike, sub::AbstractSubmittable, args...)
469469
),
470470
)
471471
else
472-
throw(UnsupportedSubmittable(sub))
472+
throw(
473+
UnsupportedSubmittable(
474+
sub,
475+
"submit(::$(typeof(model)), ::$(typeof(sub))) is not supported.",
476+
),
477+
)
473478
end
474479
end
475480

test/attributes.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,18 @@ function test_ConstraintBasisStatus_fallback()
152152
)
153153
end
154154

155+
function test_UnsupportedSubmittable()
156+
model = DummyModelWithAdd()
157+
sub = MOI.LazyConstraint{Int}(1)
158+
@test_throws(
159+
MOI.UnsupportedSubmittable(
160+
sub,
161+
"submit(::$(typeof(model)), ::$(typeof(sub))) is not supported.",
162+
),
163+
MOI.submit(model, sub, 1),
164+
)
165+
end
166+
155167
function runtests()
156168
for name in names(@__MODULE__; all = true)
157169
if startswith("$name", "test_")

0 commit comments

Comments
 (0)