@@ -252,19 +252,19 @@ collect_structarray_rec(t) = StructArrays.collect_structarray(t, initializer = i
252252
253253 v = [(a = 1 , b = 2 ), (a = 1.2 , b = 3 )]
254254 @test collect_structarray_rec (v) == StructArray ((a = [1 , 1.2 ], b = Int[2 , 3 ]))
255- @test typeof (collect_structarray_rec (v)) == typeof (StructArray ((a = [1 , 1.2 ], b = Int[2 , 3 ])))
255+ @test typeof (collect_structarray_rec (v)) == typeof (StructArray ((a = Real [1 , 1.2 ], b = Int[2 , 3 ])))
256256
257257 s = StructArray (a = [1 , 2 ], b = [3 , 4 ])
258258 @test StructArrays. collect_structarray (LazyRow (s, i) for i in eachindex (s)) == s
259259 @test collect_structarray_rec (LazyRow (s, i) for i in eachindex (s)) == s
260260
261261 v = [(a = 1 , b = 2 ), (a = 1.2 , b = " 3" )]
262262 @test collect_structarray_rec (v) == StructArray ((a = [1 , 1.2 ], b = Any[2 , " 3" ]))
263- @test typeof (collect_structarray_rec (v)) == typeof (StructArray ((a = [1 , 1.2 ], b = Any[2 , " 3" ])))
263+ @test typeof (collect_structarray_rec (v)) == typeof (StructArray ((a = Real [1 , 1.2 ], b = Any[2 , " 3" ])))
264264
265265 v = [(a = 1 , b = 2 ), (a = 1.2 , b = 2 ), (a = 1 , b = " 3" )]
266- @test collect_structarray_rec (v) == StructArray ((a = [1 , 1.2 , 1 ], b = Any[2 , 2 , " 3" ]))
267- @test typeof (collect_structarray_rec (v)) == typeof (StructArray ((a = [1 , 1.2 , 1 ], b = Any[2 , 2 , " 3" ])))
266+ @test collect_structarray_rec (v) == StructArray ((a = Real [1 , 1.2 , 1 ], b = Any[2 , 2 , " 3" ]))
267+ @test typeof (collect_structarray_rec (v)) == typeof (StructArray ((a = Real [1 , 1.2 , 1 ], b = Any[2 , 2 , " 3" ])))
268268
269269 # length unknown
270270 itr = Iterators. filter (isodd, 1 : 8 )
@@ -292,21 +292,21 @@ end
292292 @inferred StructArrays. collect_structarray (v)
293293
294294 v = [(1 , 2 ), (1.2 , 3 )]
295- @test collect_structarray_rec (v) == StructArray (([1 , 1.2 ], Int[2 , 3 ]))
295+ @test collect_structarray_rec (v) == StructArray ((Real [1 , 1.2 ], Int[2 , 3 ]))
296296
297297 v = [(1 , 2 ), (1.2 , " 3" )]
298- @test collect_structarray_rec (v) == StructArray (([1 , 1.2 ], Any[2 , " 3" ]))
299- @test typeof (collect_structarray_rec (v)) == typeof (StructArray (([1 , 1.2 ], Any[2 , " 3" ])))
298+ @test collect_structarray_rec (v) == StructArray ((Real [1 , 1.2 ], Any[2 , " 3" ]))
299+ @test typeof (collect_structarray_rec (v)) == typeof (StructArray ((Real [1 , 1.2 ], Any[2 , " 3" ])))
300300
301301 v = [(1 , 2 ), (1.2 , 2 ), (1 , " 3" )]
302- @test collect_structarray_rec (v) == StructArray (([1 , 1.2 , 1 ], Any[2 , 2 , " 3" ]))
302+ @test collect_structarray_rec (v) == StructArray ((Real [1 , 1.2 , 1 ], Any[2 , 2 , " 3" ]))
303303 # length unknown
304304 itr = Iterators. filter (isodd, 1 : 8 )
305305 tuple_itr = ((i+ 1 , i- 1 ) for i in itr)
306306 @test collect_structarray_rec (tuple_itr) == StructArray (([2 , 4 , 6 , 8 ], [0 , 2 , 4 , 6 ]))
307307 tuple_itr_real = (i == 1 ? (1.2 , i- 1 ) : (i+ 1 , i- 1 ) for i in itr)
308- @test collect_structarray_rec (tuple_itr_real) == StructArray (([1.2 , 4 , 6 , 8 ], [0 , 2 , 4 , 6 ]))
309- @test typeof (collect_structarray_rec (tuple_itr_real)) == typeof (StructArray (([1.2 , 4 , 6 , 8 ], [0 , 2 , 4 , 6 ])))
308+ @test collect_structarray_rec (tuple_itr_real) == StructArray ((Real [1.2 , 4 , 6 , 8 ], [0 , 2 , 4 , 6 ]))
309+ @test typeof (collect_structarray_rec (tuple_itr_real)) == typeof (StructArray ((Real [1.2 , 4 , 6 , 8 ], [0 , 2 , 4 , 6 ])))
310310
311311 # empty
312312 itr = Iterators. filter (t -> t > 10 , 1 : 8 )
330330 @test collect_structarray_rec (itr) == collect (itr)
331331 real_itr = (i == 1 ? 1.5 : i for i in itr)
332332 @test collect_structarray_rec (real_itr) == collect (real_itr)
333- @test eltype (collect_structarray_rec (real_itr)) == Float64
333+ @test eltype (collect_structarray_rec (real_itr)) == Real
334334
335335 # empty
336336 itr = Iterators. filter (t -> t > 10 , 1 : 8 )
352352 @test eltype (collect_structarray_rec (v)) == Pair{Int, Int}
353353
354354 v = (i == 1 ? (1.2 => i+ 1 ) : (i => i+ 1 ) for i in 1 : 3 )
355- @test collect_structarray_rec (v) == StructArray {Pair{Float64 , Int}} ([1.2 ,2 ,3 ], [2 ,3 ,4 ])
356- @test eltype (collect_structarray_rec (v)) == Pair{Float64 , Int}
355+ @test collect_structarray_rec (v) == StructArray {Pair{Real , Int}} ([1.2 ,2 ,3 ], [2 ,3 ,4 ])
356+ @test eltype (collect_structarray_rec (v)) == Pair{Real , Int}
357357
358358 v = ((a= i,) => (b= " a$i " ,) for i in 1 : 3 )
359359 @test collect_structarray_rec (v) == StructArray{Pair{NamedTuple{(:a ,),Tuple{Int64}},NamedTuple{(:b ,),Tuple{String}}}}(StructArray ((a = [1 ,2 ,3 ],)), StructArray ((b = [" a1" ," a2" ," a3" ],)))
0 commit comments