Skip to content

Commit 0c12a63

Browse files
committed
Fix tests
1 parent 82fda96 commit 0c12a63

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/abstractblocksparsearray/wrappedabstractblocksparsearray.jl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -343,17 +343,10 @@ function Base.Array(a::AnyAbstractBlockSparseArray)
343343
return Array{eltype(a)}(a)
344344
end
345345

346-
function SparseArraysBase.isstored(a::AnyAbstractBlockSparseArray, I::Int...)
347-
return @interface interface(a) isstored(a, I...)
348-
end
349-
350-
# This circumvents issues passing certain kinds of SubArrays
351-
# to the more generic block sparse `isstored` definition,
352-
# for example `blocks(a)` is broken for certain slices.
353346
function SparseArraysBase.isstored(
354-
a::SubArray{<:Any,N,<:AbstractBlockSparseArray}, I::Vararg{Int,N}
347+
a::AbstractBlockSparseArray{<:Any,N}, I::Vararg{Int,N}
355348
) where {N}
356-
return @interface DefaultArrayInterface() isstored(a, I...)
349+
return @interface interface(a) isstored(a, I...)
357350
end
358351

359352
function Base.replace_in_print_matrix(

test/test_basics.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,15 @@ arrayts = (Array, JLArray)
11791179
# Not testing other element types since they change the
11801180
# spacing so it isn't easy to make the test general.
11811181

1182+
a′ = BlockSparseVector{elt,arrayt{elt,1}}(undef, [2, 2])
1183+
@allowscalar a′[1] = 1
1184+
a = a′
1185+
@test sprint(show, "text/plain", a) ==
1186+
"$(summary(a)):\n $(eltype(a)(1))\n $(zero(eltype(a)))\n ───\n\n"
1187+
a = @view a′[:]
1188+
@test sprint(show, "text/plain", a) ==
1189+
"$(summary(a)):\n $(eltype(a)(1))\n $(zero(eltype(a)))\n\n"
1190+
11821191
a′ = BlockSparseMatrix{elt,arrayt{elt,2}}(undef, [2, 2], [2, 2])
11831192
@allowscalar a′[1, 2] = 12
11841193
for a in (a′, @view(a′[:, :]))

0 commit comments

Comments
 (0)