@@ -2,6 +2,7 @@ using StructArrays
22using StructArrays: staticschema, iscompatible, _promote_typejoin, append!!
33using OffsetArrays: OffsetArray
44import Tables, PooledArrays, WeakRefStrings
5+ using DataAPI: refarray, refvalue
56using Test
67
78@testset " index" begin
121122 b = PooledArrays. PooledArray ([" 1" , " 2" , " 3" ])
122123 c = [:a , :b , :c ]
123124 s = StructArray (a= a, b= b, c= c)
124- ref = StructArrays. refs (s)
125- @test ref[1 ]. a isa WeakRefStrings. WeakRefString{UInt8}
126- @test ref[1 ]. b isa Integer
125+ ref = refarray (s)
127126 Base. permute!! (ref, sortperm (s))
128127 @test issorted (s)
129128end
@@ -623,16 +622,26 @@ end
623622 @test str == " LazyRows(::Array{Float64,2}, ::Array{Float64,2})"
624623end
625624
626- @testset " refs " begin
625+ @testset " refarray " begin
627626 s = PooledArrays. PooledArray ([" a" , " b" , " c" , " c" ])
628- @test StructArrays . refs (s) == UInt8 .([1 , 2 , 3 , 3 ])
627+ @test refarray (s) == UInt8 .([1 , 2 , 3 , 3 ])
629628
630629 s = WeakRefStrings. StringArray ([" a" , " b" ])
631- @test StructArrays . refs (s) isa WeakRefStrings. StringArray{WeakRefStrings. WeakRefString{UInt8}}
632- @test all (isequal .(s, StructArrays . refs (s)))
630+ @test refarray (s) isa WeakRefStrings. StringArray{WeakRefStrings. WeakRefString{UInt8}}
631+ @test all (isequal .(s, refarray (s)))
633632 s = WeakRefStrings. StringArray ([" a" , missing ])
634- @test StructArrays. refs (s) isa WeakRefStrings. StringArray{Union{WeakRefStrings. WeakRefString{UInt8}, Missing}}
635- @test all (isequal .(s, StructArrays. refs (s)))
633+ @test refarray (s) isa WeakRefStrings. StringArray{Union{WeakRefStrings. WeakRefString{UInt8}, Missing}}
634+ @test all (isequal .(s, refarray (s)))
635+ a = WeakRefStrings. StringVector ([" a" , " b" , " c" ])
636+ b = PooledArrays. PooledArray ([" 1" , " 2" , " 3" ])
637+ c = [:a , :b , :c ]
638+ s = StructArray (a= a, b= b, c= c)
639+ ref = refarray (s)
640+ @test ref[1 ]. a isa WeakRefStrings. WeakRefString{UInt8}
641+ @test ref[1 ]. b isa Integer
642+ for i in 1 : 3
643+ @test refvalue (s, ref[i]) == s[i]
644+ end
636645end
637646
638647@testset " show" begin
0 commit comments