Skip to content

Unsupported attribute fails with function conversion bridge #1758

@blegat

Description

@blegat

This:

@test_throws(
MOI.UnsupportedAttribute,
MOI.optimize!(model, BadConstraintAttributeModel(T)),
)

fails with:

Test Failed at /home/blegat/.julia/dev/SDPT3/test/tmp.jl:26
  Expression: MOI.optimize!(model, MOI.Test.BadConstraintAttributeModel(T))
    Expected: MathOptInterface.UnsupportedAttribute
      Thrown: ArgumentError
ERROR: LoadError: There was an error during testing
in expression starting at /home/blegat/.julia/dev/SDPT3/test/tmp.jl:65

The ArgumentError that is thrown is:

ERROR: LoadError: ArgumentError: Bridge of type `MathOptInterface.Bridges.Constraint.ScalarFunctionizeBridge{Float64, MathOptInterface.EqualTo{Float64}}` does not support setting the attribute `MathOptInterface.Test.UnknownConstraintAttribute()` because `MOIB.Constraint.invariant_under_function_conversion(MathOptInterface.Test.UnknownConstraintAttribute())` returns `false`.
Stacktrace:
  [1] set(model::MathOptInterface.Bridges.LazyBridgeOptimizer{MathOptInterface.Utilities.CachingOptimizer{SDPT3.Optimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}}, attr::MathOptInterface.Test.UnknownConstraintAttribute, bridge::MathOptInterface.Bridges.Constraint.ScalarFunctionizeBridge{Float64, MathOptInterface.EqualTo{Float64}}, value::Int64)
    @ MathOptInterface.Bridges.Constraint ~/.julia/packages/MathOptInterface/IIN1o/src/Bridges/Constraint/function_conversion.jl:42
...

Detected while going from DeprecatedTest to Test in jump-dev/SDPT3.jl#15

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions