|
1 | 1 | module TestDuplicates |
2 | 2 |
|
3 | | -using Test, DataFrames, CategoricalArrays, Random |
| 3 | +using Test, DataFrames, CategoricalArrays, Random, PooledArrays |
4 | 4 | const ≅ = isequal |
5 | 5 |
|
6 | 6 | @testset "nonunique" begin |
@@ -30,15 +30,18 @@ const ≅ = isequal |
30 | 30 | @test_throws ArgumentError unique!(df) |
31 | 31 | @test_throws ArgumentError unique(df, true) |
32 | 32 |
|
33 | | - pdf = view(DataFrame(a=CategoricalArray(["a", "a", missing, missing, "b", missing, "a", missing]), |
34 | | - b=CategoricalArray(["a", "b", missing, missing, "b", "a", "a", "a"])), :, :) |
| 33 | + pdf = view(DataFrame(a=CategoricalArray(["a", "a", missing, missing, "b", missing, "a", missing]), |
| 34 | + b=CategoricalArray(["a", "b", missing, missing, "b", "a", "a", "a"])), :, :) |
35 | 35 | updf = DataFrame(a=CategoricalArray(["a", "a", missing, "b", missing]), |
36 | 36 | b=CategoricalArray(["a", "b", missing, "b", "a"])) |
37 | 37 | @test nonunique(pdf) == [false, false, false, true, false, false, true, true] |
38 | 38 | @test nonunique(updf) == falses(5) |
39 | 39 | @test updf ≅ unique(pdf) |
40 | 40 | @test_throws ArgumentError unique!(pdf) |
41 | 41 | @test_throws ArgumentError unique(pdf, true) |
| 42 | + |
| 43 | + @test isempty(nonunique(DataFrame(a=PooledArray(Int[])))) |
| 44 | + @test typeof(nonunique(DataFrame(a=PooledArray(Int[])))) === Vector{Bool} |
42 | 45 | end |
43 | 46 |
|
44 | 47 | @testset "nonunique, nonunique, unique! with extra argument" begin |
|
0 commit comments