File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -748,16 +748,18 @@ function test_model_ScalarFunctionConstantNotZero(
748748 try
749749 f = MOI. ScalarAffineFunction (MOI. ScalarAffineTerm{T}[], T (1 ))
750750 c = MOI. add_constraint (model, f, MOI. EqualTo (T (2 )))
751- @requires _supports (config, MOI. ConstraintFunction)
752- @test MOI. get (model, MOI. ConstraintFunction (), c) ≈ f
751+ if _supports (config, MOI. ConstraintFunction)
752+ @test MOI. get (model, MOI. ConstraintFunction (), c) ≈ f
753+ end
753754 catch err
754755 @test err == _error (MOI. EqualTo{T}, T (1 ))
755756 end
756757 try
757758 f = MOI. ScalarAffineFunction (MOI. ScalarAffineTerm{T}[], T (2 ))
758759 c = MOI. add_constraint (model, f, MOI. GreaterThan (T (1 )))
759- @requires _supports (config, MOI. ConstraintFunction)
760- @test MOI. get (model, MOI. ConstraintFunction (), c) ≈ f
760+ if _supports (config, MOI. ConstraintFunction)
761+ @test MOI. get (model, MOI. ConstraintFunction (), c) ≈ f
762+ end
761763 catch err
762764 @test err == _error (MOI. GreaterThan{T}, T (2 ))
763765 end
Original file line number Diff line number Diff line change @@ -38,6 +38,16 @@ MOI.Test.runtests(
3838 ],
3939)
4040
41+ # Test for Issue #1757
42+
43+ MOI. Test. test_model_ScalarFunctionConstantNotZero (
44+ MOI. Utilities. MockOptimizer (
45+ MOI. Utilities. Model {Float64} (),
46+ scalar_function_constant_non_zero = false ,
47+ ),
48+ MOI. Test. Config (exclude = Any[MOI. ConstraintFunction]),
49+ )
50+
4151# Test exclude_tests_after. This should work despite no methods being added for IncompleteOptimizer
4252# because every test should get skipped.
4353
You can’t perform that action at this time.
0 commit comments