From 99b6b0881ac1f481f075ab8877e0c5ab3b436b17 Mon Sep 17 00:00:00 2001 From: odow Date: Fri, 18 Jun 2021 14:27:10 +1200 Subject: [PATCH 1/2] Fix and add test for throwing UnsupportedSubmittable --- src/attributes.jl | 7 ++++++- test/attributes.jl | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/attributes.jl b/src/attributes.jl index 11a4992482..bf97bcb938 100644 --- a/src/attributes.jl +++ b/src/attributes.jl @@ -469,7 +469,12 @@ function submit(model::ModelLike, sub::AbstractSubmittable, args...) ), ) else - throw(UnsupportedSubmittable(sub)) + throw( + UnsupportedSubmittable( + sub, + "submit(::$(typeof(model)),::$(typeof(sub))) is not supported.", + ), + ) end end diff --git a/test/attributes.jl b/test/attributes.jl index f21a7d4e99..c3bf371e60 100644 --- a/test/attributes.jl +++ b/test/attributes.jl @@ -152,6 +152,18 @@ function test_ConstraintBasisStatus_fallback() ) end +function test_UnsupportedSubmittable() + model = DummyModelWithAdd() + sub = MOI.LazyConstraint{Int}(1) + @test_throws( + MOI.UnsupportedSubmittable( + sub, + "submit(::$(typeof(model)),::$(typeof(sub))) is not supported.", + ), + MOI.submit(model, sub, 1), + ) +end + function runtests() for name in names(@__MODULE__; all = true) if startswith("$name", "test_") From 9bed5ece24ef9467224bdfb430e13d9c81729ec1 Mon Sep 17 00:00:00 2001 From: odow Date: Mon, 21 Jun 2021 09:10:45 +1200 Subject: [PATCH 2/2] Fix space --- src/attributes.jl | 2 +- test/attributes.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/attributes.jl b/src/attributes.jl index bf97bcb938..51aec815fb 100644 --- a/src/attributes.jl +++ b/src/attributes.jl @@ -472,7 +472,7 @@ function submit(model::ModelLike, sub::AbstractSubmittable, args...) throw( UnsupportedSubmittable( sub, - "submit(::$(typeof(model)),::$(typeof(sub))) is not supported.", + "submit(::$(typeof(model)), ::$(typeof(sub))) is not supported.", ), ) end diff --git a/test/attributes.jl b/test/attributes.jl index c3bf371e60..0b87c474eb 100644 --- a/test/attributes.jl +++ b/test/attributes.jl @@ -158,7 +158,7 @@ function test_UnsupportedSubmittable() @test_throws( MOI.UnsupportedSubmittable( sub, - "submit(::$(typeof(model)),::$(typeof(sub))) is not supported.", + "submit(::$(typeof(model)), ::$(typeof(sub))) is not supported.", ), MOI.submit(model, sub, 1), )