Skip to content

Commit

Permalink
Merge pull request #456 from JuliaOpt/bl/deletefallback
Browse files Browse the repository at this point in the history
Fix delete fallback
  • Loading branch information
blegat authored Aug 6, 2018
2 parents 253e16c + 1a40cd2 commit 84efa5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/indextypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ by the model.
struct UnsupportedDeletion{IndexType<:Index} <: UnsupportedError
message::String
end
function UnsupportedDeletion{IndexType}() where IndexType <: Index
UnsupportedDeletion{IndexType}("")
end

function operation_name(::UnsupportedDeletion{IndexType}) where {IndexType<:Index}
return "Deleting indices of type `$IndexType`"
Expand Down
3 changes: 3 additions & 0 deletions test/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ end
@testset "Fallbacks for `set!` methods" begin
model = DummyModel()
ci = MOI.ConstraintIndex{MOI.SingleVariable, MOI.EqualTo{Float64}}(1)

@test_throws MOI.UnsupportedDeletion{typeof(ci)} MOI.delete!(model, ci)

@testset "ConstraintFunction" begin
vi = MOI.VariableIndex(1)
@test_throws MOI.UnsupportedAttribute begin
Expand Down

0 comments on commit 84efa5f

Please sign in to comment.