Skip to content

[Bridges] fix attribute_value_type(::ListOfNonstandardBridges) #2665

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

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Bridges/Bridges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"""
struct ListOfNonstandardBridges{T} <: MOI.AbstractOptimizerAttribute end

attribute_value_type(::ListOfNonstandardBridges) = Vector{Type}
MOI.attribute_value_type(::ListOfNonstandardBridges) = Vector{Type}

Check warning on line 139 in src/Bridges/Bridges.jl

View check run for this annotation

Codecov / codecov/patch

src/Bridges/Bridges.jl#L139

Added line #L139 was not covered by tests

MOI.is_copyable(::ListOfNonstandardBridges) = false

Expand Down
8 changes: 6 additions & 2 deletions test/Bridges/lazy_bridge_optimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1978,16 +1978,20 @@ function MOI.get(
::OptimizerWithBridgeListOfNonstandardBridges,
::MOI.Bridges.ListOfNonstandardBridges{T},
) where {T}
return [BridgeListOfNonstandardBridges{T}]
return Type[BridgeListOfNonstandardBridges{T}]
end

function test_toadd()
function test_ListOfNonstandardBridges()
b = MOI.Bridges.full_bridge_optimizer(
OptimizerWithBridgeListOfNonstandardBridges(),
Int,
)
@test MOI.Bridges.has_bridge(b, BridgeListOfNonstandardBridges{Int})
@test !MOI.Bridges.has_bridge(b, BridgeListOfNonstandardBridges{Float64})
attr = MOI.Bridges.ListOfNonstandardBridges{Int}()
ret = MOI.get(b, attr)
@test ret isa MOI.attribute_value_type(attr)
return
end

function test_hermitian(T = Float64)
Expand Down
Loading