From 30790bc405cbdd11bee4d45bb7c680ed8ce1d6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Mon, 27 Jan 2020 16:29:00 +0100 Subject: [PATCH 1/3] Fix tests for Julia v1.4-rc1 --- .travis.yml | 1 + test/Bridges/Variable/vectorize.jl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2906abcbb9..9ddd61d8e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ julia: - 1.1 - 1.2 - 1.3 + - 1.4 notifications: email: false git: diff --git a/test/Bridges/Variable/vectorize.jl b/test/Bridges/Variable/vectorize.jl index 08f56b1352..81f6ff58e4 100644 --- a/test/Bridges/Variable/vectorize.jl +++ b/test/Bridges/Variable/vectorize.jl @@ -115,7 +115,7 @@ end @testset "MultirowChange" begin change = MOI.MultirowChange(y, [(3, 0.0)]) - message = "The change MathOptInterface.MultirowChange{Float64}(MathOptInterface.VariableIndex(-1), Tuple{Int64,Float64}[(3, 0.0)])" * + message = "The change $change" * " contains variables bridged into a function with nonzero constant." err = MOI.ModifyConstraintNotAllowed(cis[1], change, message) @test_throws err MOI.modify(bridged_mock, cis[1], change) From 6cb17ad9a611e5aec4dc2bebca617cab82d9c4cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Tue, 28 Jan 2020 00:33:23 +0100 Subject: [PATCH 2/3] Fix MA tests --- src/Utilities/functions.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Utilities/functions.jl b/src/Utilities/functions.jl index e2dad3e088..0bd4ac8dcc 100644 --- a/src/Utilities/functions.jl +++ b/src/Utilities/functions.jl @@ -1542,6 +1542,16 @@ end function Base.:*(f::Union{MOI.SingleVariable, MOI.VectorOfVariables}, g::Number) return operate(*, typeof(g), f, g) end +# Used by sparse matrix multiplication after +# https://github.com/JuliaLang/julia/pull/33205 +function Base.:*(f::TypedLike, g::Bool) + if g + return MA.copy_if_mutable(f) + else + return zero(typeof(f)) + end +end +Base.:*(f::Bool, g::TypedLike) = g * f function Base.:^(func::MOI.ScalarAffineFunction{T}, p::Integer) where T if iszero(p) From 4bb6186cdce5d8f10fc8a1664d465219e073f014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Tue, 28 Jan 2020 16:07:35 +0100 Subject: [PATCH 3/3] Fix print test --- test/Utilities/copy.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/Utilities/copy.jl b/test/Utilities/copy.jl index 2bfd454d78..93e03c2e04 100644 --- a/test/Utilities/copy.jl +++ b/test/Utilities/copy.jl @@ -22,7 +22,11 @@ end map = MOIU.IndexMap(Dict(x => y), Dict(cx => cy)) @test length(map) == 2 # `x=>y` in Julia <= 1.1 and `x => y` in Julia >= 1.2 - x_y = string(Dict(x => y))[6:end-1] + if VERSION < v"1.2" + x_y = string(x) * "=>" * string(y) + else + x_y = string(x => y) + end compare_without_moi(sprint(show, map), "Utilities.IndexMap($x_y,Pair{ConstraintIndex,ConstraintIndex}($cx, $cy))") end