Skip to content

Commit 47ca094

Browse files
committed
Fix code coverage
1 parent 432a264 commit 47ca094

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

docs/src/extensions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The `descent_state_type` attribute specifies the solver.
8282
using JuMP, Manopt, Manifolds
8383
model = Model(Manopt.JuMP_Optimizer)
8484
# Change the solver with this option, `GradientDescentState` is the default
85-
set_attribute("descent_state_type", GradientDescentState)
85+
set_attribute(model, "descent_state_type", GradientDescentState)
8686
@variable(model, U[1:2, 1:2] in Stiefel(2, 2), start = 1.0)
8787
@objective(model, Min, sum((A - U) .^ 2))
8888
optimize!(model)
@@ -117,4 +117,4 @@ MOI.set
117117
```@autodocs
118118
Modules = [Base.get_extension(Manopt, :ManoptJuMPExt)]
119119
Order = [:type, :function]
120-
```
120+
```

ext/ManoptJuMPExt.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ Return a `Bool` indicating whether `attr.name` is a valid option name
195195
for `Manopt`.
196196
"""
197197
function MOI.supports(::ManoptOptimizer, ::MOI.RawOptimizerAttribute)
198-
@show @__LINE__
199198
# FIXME Ideally, this should only return `true` if it is a valid keyword argument for
200199
# one of the `...DescentState()` constructors. Is there an easy way to check this ?
201200
# Does it depend on the different solvers ?
@@ -208,7 +207,6 @@ end
208207
Return last `value` set by [`set`](@extref `MathOptInterface.set`)`(model, attr, value)`.
209208
"""
210209
function MOI.get(model::ManoptOptimizer, attr::MOI.RawOptimizerAttribute)
211-
@show @__LINE__
212210
return model.options[attr.name]
213211
end
214212

@@ -219,7 +217,6 @@ Set the value for the keyword argument `attr.name` to give for the constructor
219217
`model.options[DESCENT_STATE_TYPE]`.
220218
"""
221219
function MOI.set(model::ManoptOptimizer, attr::MOI.RawOptimizerAttribute, value)
222-
@show @__LINE__
223220
model.options[attr.name] = value
224221
return nothing
225222
end
@@ -253,7 +250,6 @@ uses [`default_copy_to`](@extref `MathOptInterface.Utilities.default_copy_to`) a
253250
[`add_constrained_variables`](@extref `MathOptInterface.add_constrained_variables`) and the objective sense with [`set`](@extref `MathOptInterface.set`).
254251
"""
255252
function MOI.copy_to(dest::ManoptOptimizer, src::MOI.ModelLike)
256-
@show @__LINE__
257253
return MOI.Utilities.default_copy_to(dest, src)
258254
end
259255

test/MOI_wrapper.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ function _test_sphere_sum(model, obj_sign)
3030
return nothing
3131
end
3232

33-
function test_sphere()
34-
model = Model(Manopt.JuMP_Optimizer)
33+
function test_sphere(descent_state_type; kws...)
34+
model = Model(Manopt.JuMP_Optimizer; kws...)
35+
@test MOI.supports(backend(model), MOI.RawOptimizerAttribute("descent_state_type"))
36+
set_attribute(model, "descent_state_type", descent_state_type)
3537
start = normalize(1:3)
3638
@variable(model, x[i = 1:3] in Sphere(2), start = start[i])
3739

@@ -97,11 +99,13 @@ function test_sphere()
9799
set_start_value(x[3], 1.0)
98100

99101
@variable(model, [1:2, 1:2] in Stiefel(2, 2))
100-
return @test_throws MOI.AddConstraintNotAllowed optimize!(model)
102+
@test_throws MOI.AddConstraintNotAllowed optimize!(model)
103+
return
101104
end
102105

103106
@testset "JuMP tests" begin
104-
test_sphere()
107+
test_sphere(GradientDescentState; add_bridges = true)
108+
test_sphere(GradientDescentState; add_bridges = false)
105109
end
106110

107111
function test_runtests()

0 commit comments

Comments
 (0)