|
900 | 900 | @test_throws MethodError Tables.ByRow(identity)(1)
|
901 | 901 | @test_throws MethodError Tables.ByRow(identity)([1 2])
|
902 | 902 | end
|
| 903 | + |
| 904 | +@testset "istable on dictionaries" begin |
| 905 | + @test Tables.istable(Dict{Union{String}, Vector}) |
| 906 | + @test Tables.istable(Dict{Union{Symbol}, Vector}) |
| 907 | + @test Tables.istable(Dict{Union{SubString}, Vector}) |
| 908 | + @test Tables.istable(Dict{Union{AbstractString}, Vector}) |
| 909 | + @test !Tables.istable(Dict{Union{String, Symbol}, Vector}) |
| 910 | + @test Tables.istable(Vector{Dict{Symbol}}) |
| 911 | + @test Tables.istable(Vector{Dict{String}}) |
| 912 | + @test Tables.istable(Vector{Dict{SubString}}) |
| 913 | + @test Tables.istable(Vector{Dict{AbstractString}}) |
| 914 | + |
| 915 | + @test Set(Tables.columnnames(Dict(:a=>1, :b=>2))) == Set([:a, :b]) |
| 916 | + @test Set(Tables.columnnames(Dict("a"=>1, "b"=>2))) == Set([:a, :b]) |
| 917 | + @test Set(Tables.columnnames(Dict("a"=>1, SubString("b")=>2))) == Set([:a, :b]) |
| 918 | + @test Set(Tables.columnnames(Dict(SubString("a")=>1, SubString("b")=>2))) == Set([:a, :b]) |
| 919 | + |
| 920 | + @test Tables.getcolumn(Dict(:a=>1, :b=>2), 1) == 1 |
| 921 | + @test Tables.getcolumn(Dict("a"=>1, "b"=>2), 1 + (Int === Int64)) == 1 |
| 922 | + @test Tables.getcolumn(Dict("a"=>1, SubString("b")=>2), 1 + (Int === Int64)) == 1 |
| 923 | + @test Tables.getcolumn(Dict(SubString("a")=>1, SubString("b")=>2), 1 + (Int === Int64)) == 1 |
| 924 | + @test Tables.getcolumn(Dict(:a=>1, :b=>2), :a) == 1 |
| 925 | + @test Tables.getcolumn(Dict("a"=>1, "b"=>2), :a) == 1 |
| 926 | + @test Tables.getcolumn(Dict("a"=>1, SubString("b")=>2), :a) == 1 |
| 927 | + @test Tables.getcolumn(Dict(SubString("a")=>1, SubString("b")=>2), :a) == 1 |
| 928 | + @test Tables.getcolumn(Dict(:a=>1, :b=>2), Int, 1, :a) == 1 |
| 929 | + @test Tables.getcolumn(Dict("a"=>1, "b"=>2), Int, 1, :a) == 1 |
| 930 | + @test Tables.getcolumn(Dict("a"=>1, SubString("b")=>2), Int, 1, :a) == 1 |
| 931 | + @test Tables.getcolumn(Dict(SubString("a")=>1, SubString("b")=>2), Int, 1, :a) == 1 |
| 932 | +end |
| 933 | + |
0 commit comments