Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit test for UnsupportedAttribute #957

Closed
blegat opened this issue Nov 19, 2019 · 2 comments
Closed

Add unit test for UnsupportedAttribute #957

blegat opened this issue Nov 19, 2019 · 2 comments
Labels
good first issue Status: help wanted This issue needs could use help from the community Submodule: Tests About the Tests submodule

Comments

@blegat
Copy link
Member

blegat commented Nov 19, 2019

See osqp/OSQP.jl#71 and oxfordcontrol/COSMO.jl#97

@odow odow added good first issue Status: help wanted This issue needs could use help from the community Submodule: Tests About the Tests submodule labels Dec 14, 2020
@odow
Copy link
Member

odow commented Jul 14, 2021

Closed by #1419

"""
test_model_copy_to_UnsupportedAttribute(
model::MOI.ModelLike,
::Config,
)
Test `MOI.copy_to` when an attribute is unsupported.
"""
function test_model_copy_to_UnsupportedAttribute(model::MOI.ModelLike, ::Config)
# ModelAttribute
@test !MOI.supports(model, UnknownModelAttribute())
@test_throws(
MOI.UnsupportedAttribute,
MOI.copy_to(model, BadModelAttributeModel()),
)
# VariableAttribute
@test !MOI.supports(model, UnknownVariableAttribute(), MOI.VariableIndex)
@test_throws(
MOI.UnsupportedAttribute,
MOI.copy_to(model, BadVariableAttributeModel()),
)
# ConstraintAttribute
@test !MOI.supports(
model,
UnknownConstraintAttribute(),
MOI.ConstraintIndex{MOI.SingleVariable,MOI.EqualTo{Float64}},
)
@test_throws(
MOI.UnsupportedAttribute,
MOI.copy_to(model, BadConstraintAttributeModel()),
)
return
end

@odow odow closed this as completed Jul 14, 2021
@blegat
Copy link
Member Author

blegat commented Jul 15, 2021

Nice, this should catch a few bugs in solvers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Status: help wanted This issue needs could use help from the community Submodule: Tests About the Tests submodule
Development

No branches or pull requests

2 participants