|
477 | 477 | @test df[:, Cols(x -> x[1] == 'a')] == df[:, [1, 2]] |
478 | 478 | @test df[:, Cols(x -> x[end] == '1')] == df[:, [1, 3]] |
479 | 479 | @test df[:, Cols(x -> x[end] == '3')] == DataFrame() |
480 | | - @test_throws ArgumentError df[:, Cols(x -> true, 1)] |
481 | | - @test_throws ArgumentError df[:, Cols(1, x -> true)] |
| 480 | + @test df[:, Cols(x -> true, 1)] == df |
| 481 | + @test df[:, Cols(1, x -> true)] == df |
| 482 | + @test df[:, Cols(x -> true, 1, operator=intersect)] == DataFrame(a1=1) |
| 483 | + @test df[:, Cols(1, x -> true, operator=intersect)] == DataFrame(a1=1) |
482 | 484 |
|
483 | 485 | @test ncol(select(df, Cols(operator=intersect))) == 0 |
484 | 486 | @test ncol(df[:, Cols(operator=intersect)]) == 0 |
|
539 | 541 | @test df[:, Cols(x -> x[1] == 'a', operator=intersect)] == df[:, [1, 2]] |
540 | 542 | @test df[:, Cols(x -> x[end] == '1', operator=intersect)] == df[:, [1, 3]] |
541 | 543 | @test df[:, Cols(x -> x[end] == '3', operator=intersect)] == DataFrame() |
542 | | - @test_throws ArgumentError df[:, Cols(x -> true, 1, operator=intersect)] |
543 | | - @test_throws ArgumentError df[:, Cols(1, x -> true, operator=intersect)] |
| 544 | + @test df[:, Cols(x -> true, 1, operator=intersect)] == df[:, 1:1] |
| 545 | + @test df[:, Cols(1, x -> true, operator=intersect)] == df[:, 1:1] |
| 546 | + |
| 547 | + @test df[:, Cols(startswith("a"), endswith("2"))] == |
| 548 | + select(df, Cols(startswith("a"), endswith("2"))) == |
| 549 | + df[:, ["a1", "a2", "b2"]] |
| 550 | + @test df[:, Cols(startswith("a"), endswith("2"), operator=intersect)] == |
| 551 | + df[:, Cols(startswith("a"), :, endswith("2"), operator=intersect)] == |
| 552 | + select(df, Cols(startswith("a"), endswith("2"), operator=intersect)) == |
| 553 | + df[:, ["a2"]] |
| 554 | + @test df[:, Cols(startswith("a"), endswith("2"), operator=setdiff)] == |
| 555 | + select(df, Cols(startswith("a"), endswith("2"), operator=setdiff)) == |
| 556 | + df[:, ["a1"]] |
| 557 | + @test df[:, Cols(startswith("a"), endswith("2"), :, operator=setdiff)] == DataFrame() |
544 | 558 | end |
545 | 559 |
|
546 | 560 | @testset "views" begin |
|
0 commit comments