Skip to content

Commit edb31fe

Browse files
authored
Enable show test (#245)
1 parent 8e6b2f3 commit edb31fe

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

test/jump.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function test_forward_on_trivial_qp()
4848
MOI.set(model, MOI.Silent(), true)
4949
@variable(model, x[1:2])
5050
@objective(model, Min, x' * Q * x + q' * x)
51-
@constraint(model, G * x .<= h,)
51+
@constraint(model, G * x .<= h)
5252
optimize!(model)
5353
@test JuMP.value.(x) [0.3, 0.7] atol = ATOL rtol = RTOL
5454
return
@@ -63,7 +63,7 @@ function test_differentiating_trivial_qp_1()
6363
MOI.set(model, MOI.Silent(), true)
6464
x = @variable(model, [1:2])
6565
@objective(model, Min, x' * Q * x + q' * x)
66-
@constraint(model, ctr_le, G * x .<= h,)
66+
@constraint(model, ctr_le, G * x .<= h)
6767
optimize!(model)
6868
@test JuMP.value.(x) [-0.25, -0.75] atol = ATOL rtol = RTOL
6969
MOI.set.(model, DiffOpt.ReverseVariablePrimal(), x, 1.0)
@@ -77,11 +77,9 @@ function test_differentiating_trivial_qp_1()
7777
grad_obj = MOI.get(model, DiffOpt.ReverseObjectiveFunction())
7878
@test JuMP.coefficient(grad_obj, x[1], x[2])
7979
DiffOpt.quad_sym_half.(grad_obj, x[1], x[2]) atol = ATOL rtol = RTOL
80-
8180
@test DiffOpt.quad_sym_half(grad_obj, x[1], x[1])
8281
2 * JuMP.coefficient(grad_obj, x[1], x[1]) atol = ATOL rtol = RTOL
83-
# TODO: this simple show fails
84-
@show ctr_le
82+
@test sprint(show, ctr_le) isa String
8583
return
8684
end
8785

@@ -109,8 +107,8 @@ function test_differentiating_qp_with_inequality_and_equality_constraints()
109107
MOI.set(model, MOI.Silent(), true)
110108
@variable(model, x[1:3])
111109
@objective(model, Min, x' * Q * x + q' * x)
112-
@constraint(model, ctr_le, G * x .<= h,)
113-
@constraint(model, ctr_eq, A * x .== b,)
110+
@constraint(model, ctr_le, G * x .<= h)
111+
@constraint(model, ctr_eq, A * x .== b)
114112
optimize!(model)
115113
@test JuMP.value.(x) [0.0, 0.5, 0.0] atol = ATOL rtol = RTOL
116114
MOI.set.(model, DiffOpt.ReverseVariablePrimal(), x, 1.0)

0 commit comments

Comments
 (0)