|
1 |
| -using SparseArrays, BlockArrays, Base64, FillArrays, LinearAlgebra, Test |
| 1 | +using SparseArrays, BlockArrays, FillArrays, LinearAlgebra, Test |
2 | 2 | import BlockArrays: _BlockArray
|
3 | 3 |
|
4 | 4 | function test_error_message(f, needle, expected = Exception)
|
@@ -480,24 +480,24 @@ end
|
480 | 480 | end
|
481 | 481 |
|
482 | 482 | @testset "replstring" begin
|
483 |
| - @test stringmime("text/plain",BlockArray(collect(1:4), [1,3])) == "2-blocked 4-element BlockVector{$Int}:\n 1\n ─\n 2\n 3\n 4" |
484 |
| - @test stringmime("text/plain",PseudoBlockArray(collect(1:4), [1,3])) == "2-blocked 4-element PseudoBlockVector{$Int}:\n 1\n ─\n 2\n 3\n 4" |
485 |
| - @test stringmime("text/plain",BlockArray(collect(reshape(1:16, 4, 4)), [1,3], [2,2])) == "2×2-blocked 4×4 BlockMatrix{$Int}:\n 1 5 │ 9 13\n ──────┼────────\n 2 6 │ 10 14\n 3 7 │ 11 15\n 4 8 │ 12 16" |
486 |
| - @test stringmime("text/plain",PseudoBlockArray(collect(reshape(1:16, 4, 4)), [1,3], [2,2])) == "2×2-blocked 4×4 PseudoBlockMatrix{$Int}:\n 1 5 │ 9 13\n ──────┼────────\n 2 6 │ 10 14\n 3 7 │ 11 15\n 4 8 │ 12 16" |
487 |
| - @test stringmime("text/plain",BlockArray(collect(reshape(1:8, 2, 2, 2)), [1,1], [1,1], [1,1])) == "2×2×2-blocked 2×2×2 BlockArray{$Int, 3}:\n[:, :, 1] =\n 1 3\n 2 4\n\n[:, :, 2] =\n 5 7\n 6 8" |
488 |
| - @test stringmime("text/plain",PseudoBlockArray(collect(reshape(1:8, 2, 2, 2)), [1,1], [1,1], [1,1])) == "2×2×2-blocked 2×2×2 PseudoBlockArray{$Int, 3}:\n[:, :, 1] =\n 1 3\n 2 4\n\n[:, :, 2] =\n 5 7\n 6 8" |
| 483 | + @test sprint(show, "text/plain", BlockArray(collect(1:4), [1,3])) == "2-blocked 4-element BlockVector{$Int}:\n 1\n ─\n 2\n 3\n 4" |
| 484 | + @test sprint(show, "text/plain", PseudoBlockArray(collect(1:4), [1,3])) == "2-blocked 4-element PseudoBlockVector{$Int}:\n 1\n ─\n 2\n 3\n 4" |
| 485 | + @test sprint(show, "text/plain", BlockArray(collect(reshape(1:16, 4, 4)), [1,3], [2,2])) == "2×2-blocked 4×4 BlockMatrix{$Int}:\n 1 5 │ 9 13\n ──────┼────────\n 2 6 │ 10 14\n 3 7 │ 11 15\n 4 8 │ 12 16" |
| 486 | + @test sprint(show, "text/plain", PseudoBlockArray(collect(reshape(1:16, 4, 4)), [1,3], [2,2])) == "2×2-blocked 4×4 PseudoBlockMatrix{$Int}:\n 1 5 │ 9 13\n ──────┼────────\n 2 6 │ 10 14\n 3 7 │ 11 15\n 4 8 │ 12 16" |
| 487 | + @test sprint(show, "text/plain", BlockArray(collect(reshape(1:8, 2, 2, 2)), [1,1], [1,1], [1,1])) == "2×2×2-blocked 2×2×2 BlockArray{$Int, 3}:\n[:, :, 1] =\n 1 3\n 2 4\n\n[:, :, 2] =\n 5 7\n 6 8" |
| 488 | + @test sprint(show, "text/plain", PseudoBlockArray(collect(reshape(1:8, 2, 2, 2)), [1,1], [1,1], [1,1])) == "2×2×2-blocked 2×2×2 PseudoBlockArray{$Int, 3}:\n[:, :, 1] =\n 1 3\n 2 4\n\n[:, :, 2] =\n 5 7\n 6 8" |
489 | 489 | design = zeros(Int16,6,9);
|
490 | 490 | A = BlockArray(design,[6],[4,5])
|
491 |
| - @test stringmime("text/plain",A) == "1×2-blocked 6×9 BlockMatrix{Int16}:\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0" |
| 491 | + @test sprint(show, "text/plain", A) == "1×2-blocked 6×9 BlockMatrix{Int16}:\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0" |
492 | 492 | A = PseudoBlockArray(design,[6],[4,5])
|
493 |
| - @test stringmime("text/plain",A) == "1×2-blocked 6×9 PseudoBlockMatrix{Int16}:\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0" |
| 493 | + @test sprint(show, "text/plain", A) == "1×2-blocked 6×9 PseudoBlockMatrix{Int16}:\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0\n 0 0 0 0 │ 0 0 0 0 0" |
494 | 494 | D = PseudoBlockArray(Diagonal(1:3), [1,2], [2,1])
|
495 |
| - @test stringmime("text/plain", D) == "2×2-blocked 3×3 $(PseudoBlockMatrix{Int, Diagonal{Int, UnitRange{Int}}, Tuple{BlockedUnitRange{Vector{Int}}, BlockedUnitRange{Vector{Int}}}}):\n 1 ⋅ │ ⋅\n ──────┼───\n ⋅ 2 │ ⋅\n ⋅ ⋅ │ 3" |
| 495 | + @test sprint(show, "text/plain", D) == "2×2-blocked 3×3 $(PseudoBlockMatrix{Int, Diagonal{Int, UnitRange{Int}}, Tuple{BlockedUnitRange{Vector{Int}}, BlockedUnitRange{Vector{Int}}}}):\n 1 ⋅ │ ⋅\n ──────┼───\n ⋅ 2 │ ⋅\n ⋅ ⋅ │ 3" |
496 | 496 |
|
497 | 497 | a = BlockArray{Int}(undef_blocks, [1,2])
|
498 |
| - @test stringmime("text/plain", a) == "2-blocked 3-element BlockVector{Int64}:\n #undef\n ──────\n #undef\n #undef" |
| 498 | + @test sprint(show, "text/plain", a) == "2-blocked 3-element BlockVector{Int64}:\n #undef\n ──────\n #undef\n #undef" |
499 | 499 | B = BlockArray{Int}(undef_blocks, [1,2], [1,1])
|
500 |
| - @test stringmime("text/plain", B) == "2×2-blocked 3×2 BlockMatrix{Int64}:\n #undef │ #undef\n ────────┼────────\n #undef │ #undef\n #undef │ #undef" |
| 500 | + @test sprint(show, "text/plain", B) == "2×2-blocked 3×2 BlockMatrix{Int64}:\n #undef │ #undef\n ────────┼────────\n #undef │ #undef\n #undef │ #undef" |
501 | 501 | end
|
502 | 502 |
|
503 | 503 | @testset "AbstractVector{Int} blocks" begin
|
|
0 commit comments