Skip to content

Commit

Permalink
Skip broken BlockSparseArrays tests in Julia 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Oct 10, 2024
1 parent 42d48a6 commit 08de5ec
Showing 1 changed file with 34 additions and 17 deletions.
51 changes: 34 additions & 17 deletions NDTensors/src/lib/BlockSparseArrays/test/test_basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -597,21 +597,31 @@ include("TestBlockSparseArraysUtils.jl")
c = @view b[4:8, 4:8]
@test c isa SubArray{<:Any,<:Any,<:BlockSparseArray}
@test size(c) == (5, 5)
@test block_nstored(c) == 2
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test block_nstored(c) == 2 broken = VERSION > v"1.11-"
@test blocksize(c) == (2, 2)
@test blocklengths.(axes(c)) == ([2, 3], [2, 3])
@test size(c[Block(1, 1)]) == (2, 2)
@test c[Block(1, 1)] == a[Block(2, 2)[2:3, 2:3]]
@test size(c[Block(2, 2)]) == (3, 3)
@test c[Block(2, 2)] == a[Block(1, 1)[1:3, 1:3]]
@test size(c[Block(2, 1)]) == (3, 2)
@test iszero(c[Block(2, 1)])
@test size(c[Block(1, 2)]) == (2, 3)
@test iszero(c[Block(1, 2)])
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test size(c[Block(1, 1)]) == (2, 2) broken = VERSION v"1.11-"
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test c[Block(1, 1)] == a[Block(2, 2)[2:3, 2:3]] broken = VERSION v"1.11-"
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test size(c[Block(2, 2)]) == (3, 3) broken = VERSION v"1.11-"
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test c[Block(2, 2)] == a[Block(1, 1)[1:3, 1:3]] broken = VERSION v"1.11-"
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test size(c[Block(2, 1)]) == (3, 2) broken = VERSION v"1.11-"
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test iszero(c[Block(2, 1)]) broken = VERSION v"1.11-"
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test size(c[Block(1, 2)]) == (2, 3) broken = VERSION v"1.11-"
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test iszero(c[Block(1, 2)]) broken = VERSION v"1.11-"

x = randn(elt, 3, 3)
c[Block(2, 2)] = x
@test c[Block(2, 2)] == x
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test c[Block(2, 2)] == x broken = VERSION v"1.11-"
@test a[Block(1, 1)[1:3, 1:3]] == x

a = BlockSparseArray{elt}([2, 3], [3, 4])
Expand All @@ -637,10 +647,13 @@ include("TestBlockSparseArraysUtils.jl")
@test copy(b) == a
@test blocksize(b) == (2, 2)
@test blocklengths.(axes(b)) == ([4, 4], [4, 4])
@test b[Block(1, 1)] == a[Block.(1:2), Block.(1:2)]
@test b[Block(2, 1)] == a[Block.(3:4), Block.(1:2)]
@test b[Block(1, 2)] == a[Block.(1:2), Block.(3:4)]
@test b[Block(2, 2)] == a[Block.(3:4), Block.(3:4)]
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
if VERSION < v"1.11-"
@test b[Block(1, 1)] == a[Block.(1:2), Block.(1:2)]
@test b[Block(2, 1)] == a[Block.(3:4), Block.(1:2)]
@test b[Block(1, 2)] == a[Block.(1:2), Block.(3:4)]
@test b[Block(2, 2)] == a[Block.(3:4), Block.(3:4)]
end
c = @view b[Block(2, 2)]
@test blocksize(c) == (1, 1)
@test c == a[Block.(3:4), Block.(3:4)]
Expand Down Expand Up @@ -669,13 +682,17 @@ include("TestBlockSparseArraysUtils.jl")
@test copy(b) == a[J, J]
@test blocksize(b) == (2, 2)
@test blocklengths.(axes(b)) == ([4, 4], [4, 4])
@test b[Block(1, 1)] == Array(a)[[7, 8, 5, 6], [7, 8, 5, 6]]
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test b[Block(1, 1)] == Array(a)[[7, 8, 5, 6], [7, 8, 5, 6]] broken =
VERSION v"1.11-"
c = @views b[Block(1, 1)][2:3, 2:3]
@test c == Array(a)[[8, 5], [8, 5]]
@test copy(c) == Array(a)[[8, 5], [8, 5]]
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test copy(c) == Array(a)[[8, 5], [8, 5]] broken = VERSION v"1.11-"
c = @view b[Block(1, 1)[2:3, 2:3]]
@test c == Array(a)[[8, 5], [8, 5]]
@test copy(c) == Array(a)[[8, 5], [8, 5]]
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
@test copy(c) == Array(a)[[8, 5], [8, 5]] broken = VERSION v"1.11-"
end

# TODO: Add more tests of this, it may
Expand Down

0 comments on commit 08de5ec

Please sign in to comment.