@@ -145,6 +145,42 @@ for (A, V, M) in ((NullableNominalArray, NullableNominalVector, NullableNominalM
145
145
@test x[2 ] === eltype (x)()
146
146
@test x[3 ] === eltype (x)()
147
147
@test levels (x) == [" e" , " c" ]
148
+
149
+ push! (x, " e" )
150
+ @test length (x) == 4
151
+ @test isequal (x, NullableArray ([" c" , " " , " " , " e" ], [false , true , true , false ]))
152
+ @test levels (x) == [" e" , " c" ]
153
+
154
+ push! (x, " zz" )
155
+ @test length (x) == 5
156
+ @test isequal (x, NullableArray ([" c" , " " , " " , " e" , " zz" ], [false , true , true , false , false ]))
157
+ @test levels (x) == [" e" , " c" , " zz" ]
158
+
159
+ push! (x, x[1 ])
160
+ @test length (x) == 6
161
+ @test isequal (x, NullableArray ([" c" , " " , " " , " e" , " zz" , " c" ], [false , true , true , false , false , false ]))
162
+ @test levels (x) == [" e" , " c" , " zz" ]
163
+
164
+ push! (x, eltype (x)())
165
+ @test length (x) == 7
166
+ @test isequal (x, NullableArray ([" c" , " " , " " , " e" , " zz" , " c" , " " ], [false , true , true , false , false , false , true ]))
167
+ @test isnull (x[end ])
168
+ @test levels (x) == [" e" , " c" , " zz" ]
169
+
170
+ append! (x, x)
171
+ @test isequal (x, NullableArray ([" c" , " " , " " , " e" , " zz" , " c" , " " , " c" , " " , " " , " e" , " zz" , " c" , " " ], [false , true , true , false , false , false , true , false , true , true , false , false , false , true ]))
172
+ @test length (x) == 14
173
+
174
+ b = [" z" ," y" ," x" ]
175
+ y = V {String, R} (b)
176
+ append! (x, y)
177
+ @test length (x) == 17
178
+ @test levels (x) == [" e" , " c" , " zz" , " z" , " y" , " x" ]
179
+ @test isequal (x, NullableArray ([" c" , " " , " " , " e" , " zz" , " c" , " " , " c" , " " , " " , " e" , " zz" , " c" , " " , " z" , " y" , " x" ], [false , true , true , false , false , false , true , false , true , true , false , false , false , true , false , false , false ]))
180
+
181
+ empty! (x)
182
+ @test length (x) == 0
183
+ @test levels (x) == [" e" , " c" , " zz" , " z" , " y" , " x" ]
148
184
end
149
185
150
186
@@ -361,6 +397,30 @@ for (A, V, M) in ((NullableNominalArray, NullableNominalVector, NullableNominalM
361
397
@test x[4 ] === Nullable (x. pool. valindex[4 ])
362
398
@test levels (x) == vcat (unique (a), - 1 )
363
399
400
+ push! (x, 2.0 )
401
+ @test length (x) == 5
402
+ @test isequal (x, NullableArray ([- 1.0 , - 1.0 , 1.0 , 1.5 , 2.0 ]))
403
+ @test levels (x) == [0.0 , 0.5 , 1.0 , 1.5 , - 1.0 , 2.0 ]
404
+
405
+ push! (x, x[1 ])
406
+ @test length (x) == 6
407
+ @test isequal (x, NullableArray ([- 1.0 , - 1.0 , 1.0 , 1.5 , 2.0 , - 1.0 ]))
408
+ @test levels (x) == [0.0 , 0.5 , 1.0 , 1.5 , - 1.0 , 2.0 ]
409
+
410
+ append! (x, x)
411
+ @test length (x) == 12
412
+ @test isequal (x, NullableArray ([- 1.0 , - 1.0 , 1.0 , 1.5 , 2.0 , - 1.0 , - 1.0 , - 1.0 , 1.0 , 1.5 , 2.0 , - 1.0 ]))
413
+
414
+ b = [2.5 , 3.0 , - 3.5 ]
415
+ y = V {Float64, R} (b)
416
+ append! (x, y)
417
+ @test length (x) == 15
418
+ @test isequal (x, NullableArray ([- 1.0 , - 1.0 , 1.0 , 1.5 , 2.0 , - 1.0 , - 1.0 , - 1.0 , 1.0 , 1.5 , 2.0 , - 1.0 , 2.5 , 3.0 , - 3.5 ]))
419
+ @test levels (x) == [0.0 ,0.5 ,1.0 ,1.5 ,- 1.0 ,2.0 ,2.5 ,3.0 ,- 3.5 ]
420
+
421
+ empty! (x)
422
+ @test length (x) == 0
423
+ @test levels (x) == [0.0 ,0.5 ,1.0 ,1.5 ,- 1.0 ,2.0 ,2.5 ,3.0 ,- 3.5 ]
364
424
365
425
# Matrix with no null values
366
426
for a in ([" a" " b" " c" ; " b" " a" " c" ],
0 commit comments