@@ -286,34 +286,47 @@ def test_array_deepcopy_h(self) -> None:
286286 a2 = array_deepcopy (a1 , ())
287287
288288 #---------------------------------------------------------------------------
289- def test_array2d_to_array1d_1d_a (self ) -> None :
289+ def test_array_to_tuple_array_1d_a (self ) -> None :
290290 a1 = np .arange (10 )
291291 a2 = array_to_tuple_array (a1 )
292292 self .assertEqual (a2 .tolist (), [(0 ,), (1 ,), (2 ,), (3 ,), (4 ,), (5 ,), (6 ,), (7 ,), (8 ,), (9 ,)])
293293
294- def test_array2d_to_array1d_1d_b (self ) -> None :
294+ def test_array_to_tuple_array_1d_b (self ) -> None :
295295 a1 = np .array (['aaa' , 'b' , 'ccc' ])
296296 a2 = array_to_tuple_array (a1 )
297297 self .assertEqual (a2 .tolist (), [('aaa' ,), ('b' ,), ('ccc' ,)])
298298
299- def test_array2d_to_array1d_1d_c (self ) -> None :
299+ def test_array_to_tuple_array_1d_c (self ) -> None :
300300 a1 = np .array ([None , 'b' , 30 ])
301301 a2 = array_to_tuple_array (a1 )
302302 self .assertEqual (a2 .tolist (), [(None ,), ('b' ,), (30 ,)])
303303
304- def test_array2d_to_array1d_1d_d (self ) -> None :
304+ def test_array_to_tuple_array_1d_d (self ) -> None :
305305 a1 = np .array ([('a' , 10 ), ('b' , 30 ), ('c' , 5 )], dtype = object )
306306 a2 = array_to_tuple_array (a1 ) # from 2d
307+ self .assertEqual (a2 .tolist (), [('a' , 10 ), ('b' , 30 ), ('c' , 5 )])
307308 a3 = array_to_tuple_array (a2 ) # from 1d
308309 self .assertEqual (a3 .tolist (), [('a' , 10 ), ('b' , 30 ), ('c' , 5 )])
309310
310- def test_array2d_to_array1d_1d_e (self ) -> None :
311+ def test_array_to_tuple_array_1d_e (self ) -> None :
311312 a1 = np .array ([True , False , True ], dtype = object )
312313 a2 = array_to_tuple_array (a1 )
313314 self .assertIs (a2 [0 ][0 ].__class__ , bool )
314315 self .assertEqual (a2 .tolist (), [(True ,), (False ,), (True ,)])
315316
316- def test_array2d_to_array1d_b (self ) -> None :
317+ def test_array_to_tuple_array_1d_f (self ) -> None :
318+ a1 = np .array ([None , None , None ], dtype = object )
319+ a1 [0 ] = 3
320+ a1 [1 ] = ('a' , 30 )
321+ a1 [2 ] = (None , True , 90000000 )
322+
323+ a2 = array_to_tuple_array (a1 )
324+ self .assertEqual (a2 .tolist (), [(3 ,), ('a' , 30 ), (None , True , 90000000 )])
325+
326+ a3 = array_to_tuple_array (a2 )
327+ self .assertEqual (a3 .tolist (), [(3 ,), ('a' , 30 ), (None , True , 90000000 )])
328+
329+ def test_array_to_tuple_array_b (self ) -> None :
317330 a1 = np .arange (10 , dtype = np .int64 ).reshape (5 , 2 )
318331 result = array_to_tuple_array (a1 )
319332 assert isinstance (result [0 ], tuple )
@@ -323,18 +336,18 @@ def test_array2d_to_array1d_b(self) -> None:
323336 self .assertEqual (tuple (result ), ((0 , 1 ), (2 , 3 ), (4 , 5 ), (6 , 7 ), (8 , 9 )))
324337
325338
326- def test_array2d_to_array1d_c (self ) -> None :
339+ def test_array_to_tuple_array_c (self ) -> None :
327340 a1 = np .array ([["a" , "b" ], ["ccc" , "ddd" ], ["ee" , "ff" ]])
328341 a2 = array_to_tuple_array (a1 )
329342 self .assertEqual (a2 .tolist (), [('a' , 'b' ), ('ccc' , 'ddd' ), ('ee' , 'ff' )])
330343
331- def test_array2d_to_array1d_d (self ) -> None :
344+ def test_array_to_tuple_array_d (self ) -> None :
332345 a1 = np .array ([[3 , 5 ], [10 , 20 ], [7 , 2 ]], dtype = np .uint8 )
333346 a2 = array_to_tuple_array (a1 )
334347 self .assertEqual (a2 .tolist (), [(3 , 5 ), (10 , 20 ), (7 , 2 )])
335348 self .assertIs (type (a2 [0 ][0 ]), np .uint8 )
336349
337- def test_array2d_to_array1d_e (self ) -> None :
350+ def test_array_to_tuple_array_e (self ) -> None :
338351 a1 = np .arange (20 , dtype = np .int64 ).reshape (4 , 5 )
339352 result = array_to_tuple_array (a1 )
340353 self .assertEqual (result .tolist (), [(0 , 1 , 2 , 3 , 4 ), (5 , 6 , 7 , 8 , 9 ), (10 , 11 , 12 , 13 , 14 ), (15 , 16 , 17 , 18 , 19 )])
0 commit comments