297297 SubDataset (sds, [1 , 1 , 1 ], :)
298298 end
299299end
300+ @testset " subdataset with no columns" begin # from DF.jl
301+ ds = Dataset (a= 1 : 3 , b= 4 : 6 )
302+ vds = @view ds[[3 , 1 ], 2 : 1 ]
303+ @test nrow (SubDataset (vds, Int[], :)) == 0
304+ @test nrow (SubDataset (vds, Bool[], :)) == 0
305+ @test nrow (SubDataset (vds, :, :)) == 0
306+ @test nrow (SubDataset (vds, Not (:), :)) == 0
307+ @test nrow (SubDataset (vds, Int[], [])) == 0
308+ @test nrow (SubDataset (vds, Bool[], [])) == 0
309+ @test nrow (SubDataset (vds, :, [])) == 0
310+ @test nrow (SubDataset (vds, Not (:), [])) == 0
311+ @test_throws BoundsError SubDataset (vds, [1 , 2 ], :)
312+
313+ @test nrow (view (vds, Int[], :)) == 0
314+ @test nrow (view (vds, Bool[], :)) == 0
315+ @test nrow (view (vds, :, :)) == 0
316+ @test nrow (view (vds, ! , :)) == 0
317+ @test nrow (view (vds, Not (:), :)) == 0
318+ @test nrow (view (vds, Int[], [])) == 0
319+ @test nrow (view (vds, Bool[], [])) == 0
320+ @test nrow (view (vds, :, [])) == 0
321+ @test nrow (view (vds, ! , [])) == 0
322+ @test nrow (view (vds, Not (:), [])) == 0
323+ @test_throws BoundsError view (vds, [1 , 2 ], :)
324+
325+ @test_throws BoundsError vds[1 , 1 ]
326+ @test_throws BoundsError vds[[1 , 2 ], 1 ]
327+
328+ @test nrow (getindex (vds, Int[], :)) == 0
329+ @test nrow (getindex (vds, Bool[], :)) == 0
330+ @test nrow (getindex (vds, :, :)) == 0
331+ @test nrow (getindex (vds, ! , :)) == 0
332+ @test nrow (getindex (vds, Not (:), :)) == 0
333+ @test nrow (getindex (vds, Int[], [])) == 0
334+ @test nrow (getindex (vds, Bool[], [])) == 0
335+ @test nrow (getindex (vds, :, [])) == 0
336+ @test nrow (getindex (vds, ! , [])) == 0
337+ @test nrow (getindex (vds, Not (:), [])) == 0
338+ @test_throws BoundsError getindex (vds, [1 , 2 ], :)
339+ end
0 commit comments