262262 @test d == c == StructArray (a= [1 ,10 ,2 ,3 ], b= [2 ,20 ,3 ,4 ], c= [" a" ," A" ," b" ," c" ])
263263 d = deleteat! (c, 2 )
264264 @test d == c == StructArray (a= [1 ,2 ,3 ], b= [2 ,3 ,4 ], c= [" a" ," b" ," c" ])
265- if Base. VERSION >= v " 1.7.0"
266- d = keepat! (c, 2 )
267- @test d == c == StructArray (a= [2 ], b= [3 ], c= [" b" ])
268- end
265+ d = keepat! (c, 2 )
266+ @test d == c == StructArray (a= [2 ], b= [3 ], c= [" b" ])
269267
270268 c = StructArray (a= [1 ], b= [2 ], c= [" a" ])
271269 d = [(a= 10 , b= 20 , c= " A" )]
302300 @test d == c == StructArray {C} (a= [1 ,10 ,2 ,3 ], b= [2 ,20 ,3 ,4 ], c= [" a" ," A" ," b" ," c" ])
303301 d = deleteat! (c, 2 )
304302 @test d == c == StructArray {C} (a= [1 ,2 ,3 ], b= [2 ,3 ,4 ], c= [" a" ," b" ," c" ])
305- if Base. VERSION >= v " 1.7.0"
306- d = keepat! (c, 2 )
307- @test d == c == StructArray {C} (a= [2 ], b= [3 ], c= [" b" ])
308- end
303+ d = keepat! (c, 2 )
304+ @test d == c == StructArray {C} (a= [2 ], b= [3 ], c= [" b" ])
309305
310306 c = StructArray {C} (a= [1 ], b= [2 ], c= [" a" ])
311307 d = [C (10 , 20 , " A" )]
@@ -495,14 +491,12 @@ end
495491end
496492
497493@testset " constructor from slices" begin
498- if VERSION >= v " 1.1"
499- X = [1.0 2.0 ; 3.0 4.0 ]
500- @test StructArray {Complex{Float64}} (X; dims= 1 ) == [Complex (1.0 ,3.0 ), Complex (2.0 ,4.0 )]
501- @test StructArray {Complex{Float64}} (X; dims= 2 ) == [Complex (1.0 ,2.0 ), Complex (3.0 ,4.0 )]
494+ X = [1.0 2.0 ; 3.0 4.0 ]
495+ @test StructArray {Complex{Float64}} (X; dims= 1 ) == [Complex (1.0 ,3.0 ), Complex (2.0 ,4.0 )]
496+ @test StructArray {Complex{Float64}} (X; dims= 2 ) == [Complex (1.0 ,2.0 ), Complex (3.0 ,4.0 )]
502497
503- X = [1.0 2.0 ; 3.0 4.0 ; 5.0 6.0 ]
504- @test StructArray {Tuple{Float64,Complex{Float64}}} (X; dims= 1 ) == [(1.0 ,Complex (3.0 ,5.0 )), (2.0 , Complex (4.0 ,6.0 ))]
505- end
498+ X = [1.0 2.0 ; 3.0 4.0 ; 5.0 6.0 ]
499+ @test StructArray {Tuple{Float64,Complex{Float64}}} (X; dims= 1 ) == [(1.0 ,Complex (3.0 ,5.0 )), (2.0 , Complex (4.0 ,6.0 ))]
506500end
507501
508502struct A
@@ -1111,19 +1105,11 @@ end
11111105 io = IOBuffer ()
11121106 Base. showarg (io, rows, true )
11131107 str = String (take! (io))
1114- if VERSION < v " 1.6-"
1115- @test str == " LazyRows(::Array{Float64,2}, ::Array{Float64,2}) with eltype LazyRow{Complex{Float64}}"
1116- else
1117- @test str == " LazyRows(::Matrix{Float64}, ::Matrix{Float64}) with eltype LazyRow{ComplexF64}"
1118- end
1108+ @test str == " LazyRows(::Matrix{Float64}, ::Matrix{Float64}) with eltype LazyRow{ComplexF64}"
11191109 io = IOBuffer ()
11201110 Base. showarg (io, rows, false )
11211111 str = String (take! (io))
1122- if VERSION < v " 1.6-"
1123- @test str == " LazyRows(::Array{Float64,2}, ::Array{Float64,2})"
1124- else
1125- @test str == " LazyRows(::Matrix{Float64}, ::Matrix{Float64})"
1126- end
1112+ @test str == " LazyRows(::Matrix{Float64}, ::Matrix{Float64})"
11271113 s = StructArray ((rand (10 , 10 ), rand (10 , 10 )))
11281114 rows = LazyRows (s)
11291115 @test IndexStyle (rows) isa IndexLinear
@@ -1143,19 +1129,11 @@ end
11431129 io = IOBuffer ()
11441130 Base. showarg (io, rows, true )
11451131 str = String (take! (io))
1146- if VERSION < v " 1.6-"
1147- @test str == " LazyRows(::Array{Float64,2}, ::Array{Float64,2}) with eltype LazyRow{Tuple{Float64,Float64}}"
1148- else
1149- @test str == " LazyRows(::Matrix{Float64}, ::Matrix{Float64}) with eltype LazyRow{Tuple{Float64, Float64}}"
1150- end
1132+ @test str == " LazyRows(::Matrix{Float64}, ::Matrix{Float64}) with eltype LazyRow{Tuple{Float64, Float64}}"
11511133 io = IOBuffer ()
11521134 Base. showarg (io, rows, false )
11531135 str = String (take! (io))
1154- if VERSION < v " 1.6-"
1155- @test str == " LazyRows(::Array{Float64,2}, ::Array{Float64,2})"
1156- else
1157- @test str == " LazyRows(::Matrix{Float64}, ::Matrix{Float64})"
1158- end
1136+ @test str == " LazyRows(::Matrix{Float64}, ::Matrix{Float64})"
11591137end
11601138
11611139@testset " refarray" begin
@@ -1185,19 +1163,11 @@ end
11851163 io = IOBuffer ()
11861164 Base. showarg (io, s, true )
11871165 str = String (take! (io))
1188- if VERSION < v " 1.6-"
1189- @test str == " StructArray(::Array{Int64,1}, ::Array{Int64,1}) with eltype Complex{Int64}"
1190- else
1191- @test str == " StructArray(::Vector{Int64}, ::Vector{Int64}) with eltype Complex{Int64}"
1192- end
1166+ @test str == " StructArray(::Vector{Int64}, ::Vector{Int64}) with eltype Complex{Int64}"
11931167 io = IOBuffer ()
11941168 Base. showarg (io, s, false )
11951169 str = String (take! (io))
1196- if VERSION < v " 1.6-"
1197- @test str == " StructArray(::Array{Int64,1}, ::Array{Int64,1})"
1198- else
1199- @test str == " StructArray(::Vector{Int64}, ::Vector{Int64})"
1200- end
1170+ @test str == " StructArray(::Vector{Int64}, ::Vector{Int64})"
12011171end
12021172
12031173@testset " append!!" begin
@@ -1474,7 +1444,7 @@ end
14741444 t = map (x -> (a= rand ([" " , 1 , nothing ]),), StructVector (a= 1 : 10 )):: StructVector
14751445 @test eltype (t) <: NamedTuple{(:a,)}
14761446
1477- t = VERSION >= v " 1.7 " ? @inferred ( map (x -> (a = x . a, b = 2 ), s)) : map (x -> (a= x. a, b= 2 ), s)
1447+ t = @inferred map (x -> (a= x. a, b= 2 ), s)
14781448 @test t isa StructArray
14791449 @test map (x -> (a= x. a, b= 2 ), s) == [(a= 1 , b= 2 ), (a= 2 , b= 2 ), (a= 3 , b= 2 )]
14801450
0 commit comments