Skip to content

Commit 156dc8d

Browse files
committed
Fix show with 1 row block (#56)
1 parent b8365fb commit 156dc8d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/show.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function _blockarray_print_matrix_row(io::IO,
4040
cumul += 1
4141
if ndims(X) == 2
4242
# Have accumulated enough for the block, should print a |
43-
if block < length(cumulsizes(X,2)) - 1 && cumul == blocksize(X, (2, block))[2]
43+
if block < length(cumulsizes(X,2)) - 1 && cumul == blocksize(X, 2, block)[2]
4444
block += 1
4545
cumul = 0
4646
print(io, "")

test/test_blockarrays.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,12 @@ end
235235

236236

237237
replstrmime(x) = stringmime("text/plain", x)
238-
@test replstrmime(BlockArray(collect(reshape(1:16, 4, 4)), [1,3], [2,2])) == "4×4 BlockArray{Int64,2,Array{Int64,2}}:\n 1 5 │ 9 13\n ──────┼────────\n 2 6 │ 10 14\n 3 7 │ 11 15\n 4 8 │ 12 16"
238+
@testset "replstring" begin
239+
@test replstrmime(BlockArray(collect(reshape(1:16, 4, 4)), [1,3], [2,2])) == "4×4 BlockArray{Int64,2,Array{Int64,2}}:\n 1 5 │ 9 13\n ──────┼────────\n 2 6 │ 10 14\n 3 7 │ 11 15\n 4 8 │ 12 16"
240+
design = zeros(Int16,6,9);
241+
A = BlockArray(design,[6],[4,5])
242+
@test replstrmime(A) == "6×9 BlockArray{Int16,2,Array{Int16,2}}:\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"
243+
end
239244

240245
@testset "AbstractVector{Int} blocks" begin
241246
A = BlockArray(ones(6,6), 1:3, 1:3)

0 commit comments

Comments
 (0)