105
105
@test StructArrays. strip_params (Tuple{Int}) == Tuple
106
106
@test StructArrays. astuple (NamedTuple{(:a ,), Tuple{Float64}}) == Tuple{Float64}
107
107
@test StructArrays. strip_params (NamedTuple{(:a ,), Tuple{Float64}}) == NamedTuple{(:a ,)}
108
+
109
+ cols = (a= rand (2 ), b= rand (2 ), c= rand (2 ))
110
+ @test StructArrays. findconsistentvalue (length, cols) == 2
111
+ @test StructArrays. findconsistentvalue (length, Tuple (cols)) == 2
112
+
113
+ cols = (a= rand (2 ), b= rand (2 ), c= rand (3 ))
114
+ @test isnothing (StructArrays. findconsistentvalue (length, cols))
115
+ @test isnothing (StructArrays. findconsistentvalue (length, Tuple (cols)))
108
116
end
109
117
110
118
@testset " indexstyle" begin
439
447
@test isequal (t. a, [1 , missing ])
440
448
@test eltype (t) <: NamedTuple{(:a,)}
441
449
442
- @test_throws ErrorException StructArray ([nothing ])
443
- @test_throws ErrorException StructArray ([1 , 2 , 3 ])
450
+ @test_throws ArgumentError StructArray ([nothing ])
451
+ @test_throws ArgumentError StructArray ([1 , 2 , 3 ])
444
452
end
445
453
446
454
@testset " tuple case" begin
@@ -460,10 +468,10 @@ end
460
468
@test getproperty (t, 1 ) == [2 ]
461
469
@test getproperty (t, 2 ) == [3.0 ]
462
470
463
- @test_throws ErrorException StructArray (([1 , 2 ], [3 ]))
471
+ @test_throws ArgumentError StructArray (([1 , 2 ], [3 ]))
464
472
465
- @test_throws ErrorException StructArray {Tuple{}} (())
466
- @test_throws ErrorException StructArray {Tuple{}, 1, Tuple{}} (())
473
+ @test_throws ArgumentError StructArray {Tuple{}} (())
474
+ @test_throws ArgumentError StructArray {Tuple{}, 1, Tuple{}} (())
467
475
end
468
476
469
477
@testset " constructor from slices" begin
503
511
@test t1 == StructArray ((a= [1.2 ], b= [" test" ]))
504
512
@test t2 == StructArray {Pair{Float64, String}} (([1.2 ], [" test" ]))
505
513
506
- @test_throws ErrorException StructArray (a= [1 , 2 ], b= [3 ])
514
+ @test_throws ArgumentError StructArray (a= [1 , 2 ], b= [3 ])
507
515
end
508
516
509
517
@testset " complex" begin
0 commit comments