@@ -360,6 +360,9 @@ bview(a, b) = Base.invoke(view, Tuple{AbstractArray,Any}, a, b)
360360 a = randn (6 , 6 )
361361 for mask in ([true , true , false , false , true , false ], BitVector ([true , true , false , false , true , false ]))
362362 I = BlockedVector (mask, [3 , 3 ])
363+ @test Base. to_index (I) == BlockedLogicalIndex (I)
364+ @test Base. to_index (I) == [1 , 2 , 5 ]
365+ @test Base. to_index (I) isa BlockedLogicalIndex
363366 @test to_indices (a, (I, I)) == to_indices (a, (mask, mask))
364367 @test to_indices (a, (I, I)) == (BlockedVector (LogicalIndex (mask), [2 , 1 ]), BlockedVector (LogicalIndex (mask), [2 , 1 ]))
365368 @test to_indices (a, (I, I)) isa Tuple{BlockedLogicalIndex{Int},BlockedLogicalIndex{Int}}
@@ -372,7 +375,15 @@ bview(a, b) = Base.invoke(view, Tuple{AbstractArray,Any}, a, b)
372375 @test parentindices (view (a, I, I)) == (BlockedVector ([1 , 2 , 5 ], [2 , 1 ]), BlockedVector ([1 , 2 , 5 ], [2 , 1 ]))
373376 @test parentindices (view (a, I, I)) isa Tuple{BlockedVector{Int,Vector{Int}},BlockedVector{Int,Vector{Int}}}
374377 @test blocklengths .(Base. axes1 .(parentindices (view (a, I, I)))) == ([2 , 1 ], [2 , 1 ])
378+ @test sprint (show, BlockedLogicalIndex (I)) == " [1, 2, 5]"
375379 end
380+ bl = BlockedLogicalIndex (BlockedVector ([true , true , false , false , true , false ], [3 , 3 ]))
381+ @test sprint (show, " text/plain" , bl) ==
382+ " 2-blocked 3-element BlockedVector{Int64, Base.LogicalIndex{Int64, BlockedVector{Bool, Vector{Bool}, Tuple{BlockedOneTo{Int64, Vector{Int64}}}}}, Tuple{BlockedOneTo{Int64, Vector{Int64}}}}:\n 1\n 2\n ─\n 5"
383+ @test checkbounds (Bool, randn (6 ), bl)
384+ @test ! checkbounds (Bool, randn (5 ), bl)
385+ @test checkindex (Bool, 1 : 6 , bl)
386+ @test ! checkindex (Bool, 1 : 5 , bl)
376387 end
377388end
378389
0 commit comments