@@ -198,24 +198,24 @@ end
198
198
199
199
@testset " OffsetVector" begin
200
200
# initialization
201
- one_based_axes = [
202
- (Base. OneTo (4 ), ),
203
- (1 : 4 , ),
204
- (CartesianIndex (1 ): CartesianIndex (4 ), ),
205
- (IdentityUnitRange (1 : 4 ), ),
206
- (IdOffsetRange (1 : 4 ),),
201
+ one_based_axes = Any [
202
+ (Base. OneTo (4 ), ),
203
+ (1 : 4 , ),
204
+ (CartesianIndex (1 ): CartesianIndex (4 ), ),
205
+ (IdentityUnitRange (1 : 4 ), ),
206
+ (IdOffsetRange (1 : 4 ),),
207
207
(IdOffsetRange (3 : 6 , - 2 ),)
208
208
]
209
209
210
- offset_axes = [
211
- (- 1 : 2 , ),
212
- (CartesianIndex (- 1 ): CartesianIndex (2 ), ),
213
- (IdentityUnitRange (- 1 : 2 ), ),
214
- (IdOffsetRange (- 1 : 2 ),),
210
+ offset_axes = Any [
211
+ (- 1 : 2 , ),
212
+ (CartesianIndex (- 1 ): CartesianIndex (2 ), ),
213
+ (IdentityUnitRange (- 1 : 2 ), ),
214
+ (IdOffsetRange (- 1 : 2 ),),
215
215
(IdOffsetRange (3 : 6 , - 4 ),)
216
216
]
217
217
218
- for inds in [size .(one_based_axes[1 ], 1 ), one_based_axes... ]
218
+ for inds in Any [size .(one_based_axes[1 ], 1 ), one_based_axes... ]
219
219
# test indices API
220
220
a = OffsetVector {Float64} (undef, inds)
221
221
@test eltype (a) === Float64
248
248
a = OffsetVector {Missing} (missing , inds)
249
249
@test axes (a) === ax
250
250
251
- for (T, t) in [(Nothing, nothing ), (Missing, missing )]
251
+ for (T, t) in Any [(Nothing, nothing ), (Missing, missing )]
252
252
a = OffsetVector {Union{T, Vector{Int}}} (undef, inds)
253
253
@test ! isassigned (a, - 1 )
254
254
@test eltype (a) === Union{T, Vector{Int}}
282
282
# nested offset array
283
283
a = rand (4 )
284
284
oa = OffsetArray (a, - 1 )
285
- for inds in [.- oa. offsets, one_based_axes... ]
285
+ for inds in Any [.- oa. offsets, one_based_axes... ]
286
286
ooa = OffsetArray (oa, inds)
287
287
@test typeof (parent (ooa)) <: Vector
288
288
@test ooa === OffsetArray (oa, inds... ) === OffsetVector (oa, inds) === OffsetVector (oa, inds... )
324
324
325
325
@testset " OffsetMatrix" begin
326
326
# initialization
327
-
328
- one_based_axes = [
327
+
328
+ one_based_axes = Any [
329
329
(Base. OneTo (4 ), Base. OneTo (3 )),
330
330
(1 : 4 , 1 : 3 ),
331
331
(CartesianIndex (1 , 1 ): CartesianIndex (4 , 3 ), ),
338
338
(IdOffsetRange (3 : 6 , - 2 ), 1 : 3 ),
339
339
]
340
340
341
- offset_axes = [
341
+ offset_axes = Any [
342
342
(- 1 : 2 , 0 : 2 ),
343
343
(CartesianIndex (- 1 , 0 ): CartesianIndex (2 , 2 ), ),
344
344
(- 1 : 2 , CartesianIndex (0 ): CartesianIndex (2 )),
351
351
(IdOffsetRange (- 1 : 2 ), 0 : 2 ),
352
352
]
353
353
354
- for inds in [size .(one_based_axes[1 ], 1 ), one_based_axes... ]
354
+ for inds in Any [size .(one_based_axes[1 ], 1 ), one_based_axes... ]
355
355
# test API
356
356
a = OffsetMatrix {Float64} (undef, inds)
357
357
ax = (IdOffsetRange (Base. OneTo (4 ), 0 ), IdOffsetRange (Base. OneTo (3 ), 0 ))
385
385
a = OffsetMatrix {Missing} (missing , inds)
386
386
@test axes (a) === ax
387
387
388
- for (T, t) in [(Nothing, nothing ), (Missing, missing )]
388
+ for (T, t) in Any [(Nothing, nothing ), (Missing, missing )]
389
389
a = OffsetMatrix {Union{T, Vector{Int}}} (undef, inds)
390
390
@test ! isassigned (a, - 1 , 0 )
391
391
@test eltype (a) === Union{T, Vector{Int}}
421
421
# nested offset array
422
422
a = rand (4 , 3 )
423
423
oa = OffsetArray (a, - 1 , - 2 )
424
- for inds in [.- oa. offsets, one_based_axes... ]
424
+ for inds in Any [.- oa. offsets, one_based_axes... ]
425
425
ooa = OffsetArray (oa, inds)
426
426
@test ooa === OffsetArray (oa, inds... ) === OffsetMatrix (oa, inds) === OffsetMatrix (oa, inds... )
427
427
@test typeof (parent (ooa)) <: Matrix
@@ -496,13 +496,13 @@ end
496
496
@testset " convenience constructors" begin
497
497
ax = (2 : 3 , 4 : 5 )
498
498
499
- for f in [ zeros, ones]
499
+ for f in ( zeros, ones)
500
500
a = f (Float64, ax)
501
501
@test axes (a) == ax
502
502
@test eltype (a) == Float64
503
503
end
504
504
505
- for f in [ trues, falses]
505
+ for f in ( trues, falses)
506
506
a = f (ax)
507
507
@test axes (a) == ax
508
508
@test eltype (a) == Bool
573
573
end
574
574
@testset " TupleOfRanges" begin
575
575
Base. to_indices (A, inds, t:: Tuple{TupleOfRanges{N}} ) where {N} = t
576
- OffsetArrays. AxisConversionStyle (:: Type{TupleOfRanges{N}} ) where {N} =
576
+ OffsetArrays. AxisConversionStyle (:: Type{TupleOfRanges{N}} ) where {N} =
577
577
OffsetArrays. TupleOfRanges ()
578
578
579
579
Base. convert (:: Type {Tuple{Vararg{AbstractUnitRange{Int}}}}, t:: TupleOfRanges ) = t. x
584
584
@test axes (oa) == inds. x
585
585
end
586
586
@testset " NewColon" begin
587
- Base. to_indices (A, inds, t:: Tuple{NewColon,Vararg{Any}} ) =
587
+ Base. to_indices (A, inds, t:: Tuple{NewColon,Vararg{Any}} ) =
588
588
(_uncolon (inds, t), to_indices (A, Base. tail (inds), Base. tail (t))... )
589
589
590
590
_uncolon (inds:: Tuple{} , I:: Tuple{NewColon, Vararg{Any}} ) = OneTo (1 )
598
598
599
599
@testset " Offset range construction" begin
600
600
r = - 2 : 5
601
- for AT in [OffsetArray, OffsetVector]
601
+ for AT in Any [OffsetArray, OffsetVector]
602
602
y = AT (r, r)
603
603
@test axes (y) == (r,)
604
604
@test step (y) == step (r)
@@ -1236,8 +1236,8 @@ end
1236
1236
@test sort (A, dims = 1 ) == OffsetArray (sort (parent (A), dims = 1 ), A. offsets)
1237
1237
@test sort (A, dims = 2 ) == OffsetArray (sort (parent (A), dims = 2 ), A. offsets)
1238
1238
1239
- @test mapslices (v -> sort (v) , A, dims = 1 ) == OffsetArray (mapslices (v -> sort (v) , parent (A), dims = 1 ), A. offsets)
1240
- @test mapslices (v -> sort (v) , A, dims = 2 ) == OffsetArray (mapslices (v -> sort (v) , parent (A), dims = 2 ), A. offsets)
1239
+ @test mapslices (sort, A, dims = 1 ) == OffsetArray (mapslices (sort, parent (A), dims = 1 ), A. offsets)
1240
+ @test mapslices (sort, A, dims = 2 ) == OffsetArray (mapslices (sort, parent (A), dims = 2 ), A. offsets)
1241
1241
end
1242
1242
1243
1243
@testset " rot/reverse" begin
0 commit comments