Skip to content

Commit cdf4ae1

Browse files
committed
Fix tests
1 parent 4b31589 commit cdf4ae1

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

src/abstractblocksparsearray/wrappedabstractblocksparsearray.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ using BlockArrays:
1010
mortar,
1111
unblock
1212
using DerivableInterfaces: DerivableInterfaces, @interface
13+
using GPUArraysCore: @allowscalar
1314
using SplitApplyCombine: groupcount
1415
using TypeParameterAccessors: similartype
1516

@@ -390,6 +391,6 @@ function Base.show(io::IO, mime::MIME"text/plain", a::AnyAbstractBlockSparseArra
390391
print(io, ":")
391392
println(io)
392393
a′ = ReplacedUnstoredBlockSparseArray(a, GetUnstoredBlockShow(axes(a)))
393-
Base.print_array(io, a′)
394+
@allowscalar Base.print_array(io, a′)
394395
return nothing
395396
end

test/test_basics.jl

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,22 +1090,40 @@ arrayts = (Array, JLArray)
10901090
arrayt_elt = arrayt{elt,3}
10911091

10921092
a = BlockSparseVector{elt,arrayt{elt,1}}([2, 2])
1093-
@test sprint(summary, a) ==
1093+
# Either option is possible depending on namespacing.
1094+
@test (
1095+
sprint(summary, a) ==
10941096
"2-blocked 4-element BlockSparseVector{$(elt), $(vectort_elt), …}"
1097+
) || (
1098+
sprint(summary, a) ==
1099+
"2-blocked 4-element BlockSparseArrays.BlockSparseVector{$(elt), $(vectort_elt), …}"
1100+
)
10951101

10961102
a = BlockSparseMatrix{elt,arrayt{elt,2}}([2, 2], [2, 2])
1097-
@test sprint(summary, a) ==
1098-
"2×2-blocked 4×4 BlockSparseMatrix{$(elt), $(matrixt_elt), …}"
1103+
# Either option is possible depending on namespacing.
1104+
@test (
1105+
sprint(summary, a) == "2×2-blocked 4×4 BlockSparseMatrix{$(elt), $(matrixt_elt), …}"
1106+
) || (
1107+
sprint(summary, a) ==
1108+
"2×2-blocked 4×4 BlockSparseArrays.BlockSparseMatrix{$(elt), $(matrixt_elt), …}"
1109+
)
10991110

11001111
a = BlockSparseArray{elt,3,arrayt{elt,3}}([2, 2], [2, 2], [2, 2])
1101-
@test sprint(summary, a) ==
1112+
1113+
# Either option is possible depending on namespacing.
1114+
@test (
1115+
sprint(summary, a) ==
11021116
"2×2×2-blocked 4×4×4 BlockSparseArray{$(elt), 3, $(arrayt_elt), …}"
1117+
) || (
1118+
sprint(summary, a) ==
1119+
"2×2×2-blocked 4×4×4 BlockSparseArrays.BlockSparseArray{$(elt), 3, $(arrayt_elt), …}"
1120+
)
11031121

11041122
if elt === Float64
11051123
# Not testing other element types since they change the
11061124
# spacing so it isn't easy to make the test general.
11071125
a = BlockSparseMatrix{elt,arrayt{elt,2}}([2, 2], [2, 2])
1108-
a[1, 2] = 12
1126+
@allowscalar a[1, 2] = 12
11091127
@test sprint(show, "text/plain", a) ==
11101128
"$(summary(a)):\n $(zero(eltype(a))) $(eltype(a)(12)) │ . .\n $(zero(eltype(a))) $(zero(eltype(a))) │ . .\n ───────────┼──────\n . . │ . .\n . . │ . ."
11111129
end

0 commit comments

Comments
 (0)