2222from arraykit import first_true_1d
2323from arraykit import first_true_2d
2424from arraykit import slice_to_ascending_slice
25- from arraykit import array2d_to_array1d
26- from arraykit import array2d_tuple_iter
25+ from arraykit import array_to_tuple_array
26+ from arraykit import array_to_tuple_iter
2727
2828from performance .reference .util import get_new_indexers_and_screen_ak as get_new_indexers_and_screen_full
2929from arraykit import get_new_indexers_and_screen
@@ -288,33 +288,33 @@ def test_array_deepcopy_h(self) -> None:
288288 #---------------------------------------------------------------------------
289289 def test_array2d_to_array1d_1d_a (self ) -> None :
290290 a1 = np .arange (10 )
291- a2 = array2d_to_array1d (a1 )
291+ a2 = array_to_tuple_array (a1 )
292292 self .assertEqual (a2 .tolist (), [(0 ,), (1 ,), (2 ,), (3 ,), (4 ,), (5 ,), (6 ,), (7 ,), (8 ,), (9 ,)])
293293
294294 def test_array2d_to_array1d_1d_b (self ) -> None :
295295 a1 = np .array (['aaa' , 'b' , 'ccc' ])
296- a2 = array2d_to_array1d (a1 )
296+ a2 = array_to_tuple_array (a1 )
297297 self .assertEqual (a2 .tolist (), [('aaa' ,), ('b' ,), ('ccc' ,)])
298298
299299 def test_array2d_to_array1d_1d_c (self ) -> None :
300300 a1 = np .array ([None , 'b' , 30 ])
301- a2 = array2d_to_array1d (a1 )
301+ a2 = array_to_tuple_array (a1 )
302302 self .assertEqual (a2 .tolist (), [(None ,), ('b' ,), (30 ,)])
303303
304304 def test_array2d_to_array1d_1d_d (self ) -> None :
305305 a1 = np .array ([('a' , 10 ), ('b' , 30 ), ('c' , 5 )], dtype = object )
306- a2 = array2d_to_array1d (a1 )
306+ a2 = array_to_tuple_array (a1 )
307307 self .assertEqual (a2 .tolist (), [('a' , 10 ), ('b' , 30 ), ('c' , 5 )])
308308
309309 def test_array2d_to_array1d_1d_e (self ) -> None :
310310 a1 = np .array ([True , False , True ], dtype = object )
311- a2 = array2d_to_array1d (a1 )
311+ a2 = array_to_tuple_array (a1 )
312312 self .assertIs (a2 [0 ][0 ].__class__ , bool )
313313 self .assertEqual (a2 .tolist (), [(True ,), (False ,), (True ,)])
314314
315315 def test_array2d_to_array1d_b (self ) -> None :
316316 a1 = np .arange (10 , dtype = np .int64 ).reshape (5 , 2 )
317- result = array2d_to_array1d (a1 )
317+ result = array_to_tuple_array (a1 )
318318 assert isinstance (result [0 ], tuple )
319319 assert result [0 ] == (0 , 1 )
320320 self .assertIs (type (result [0 ][0 ]), np .int64 )
@@ -324,35 +324,35 @@ def test_array2d_to_array1d_b(self) -> None:
324324
325325 def test_array2d_to_array1d_c (self ) -> None :
326326 a1 = np .array ([["a" , "b" ], ["ccc" , "ddd" ], ["ee" , "ff" ]])
327- a2 = array2d_to_array1d (a1 )
327+ a2 = array_to_tuple_array (a1 )
328328 self .assertEqual (a2 .tolist (), [('a' , 'b' ), ('ccc' , 'ddd' ), ('ee' , 'ff' )])
329329
330330 def test_array2d_to_array1d_d (self ) -> None :
331331 a1 = np .array ([[3 , 5 ], [10 , 20 ], [7 , 2 ]], dtype = np .uint8 )
332- a2 = array2d_to_array1d (a1 )
332+ a2 = array_to_tuple_array (a1 )
333333 self .assertEqual (a2 .tolist (), [(3 , 5 ), (10 , 20 ), (7 , 2 )])
334334 self .assertIs (type (a2 [0 ][0 ]), np .uint8 )
335335
336336 def test_array2d_to_array1d_e (self ) -> None :
337337 a1 = np .arange (20 , dtype = np .int64 ).reshape (4 , 5 )
338- result = array2d_to_array1d (a1 )
338+ result = array_to_tuple_array (a1 )
339339 self .assertEqual (result .tolist (), [(0 , 1 , 2 , 3 , 4 ), (5 , 6 , 7 , 8 , 9 ), (10 , 11 , 12 , 13 , 14 ), (15 , 16 , 17 , 18 , 19 )])
340340
341341 #---------------------------------------------------------------------------
342342 def test_array2d_tuple_iter_a (self ) -> None :
343343 a1 = np .arange (20 , dtype = np .int64 ).reshape (4 , 5 )
344- result = list (array2d_tuple_iter (a1 ))
344+ result = list (array_to_tuple_iter (a1 ))
345345 self .assertEqual (len (result ), 4 )
346346 self .assertEqual (result , [(0 , 1 , 2 , 3 , 4 ), (5 , 6 , 7 , 8 , 9 ), (10 , 11 , 12 , 13 , 14 ), (15 , 16 , 17 , 18 , 19 )])
347347
348348 def test_array2d_tuple_iter_b (self ) -> None :
349349 a1 = np .arange (20 , dtype = np .int64 ).reshape (10 , 2 )
350- result = list (array2d_tuple_iter (a1 ))
350+ result = list (array_to_tuple_iter (a1 ))
351351 self .assertEqual (result , [(0 , 1 ), (2 , 3 ), (4 , 5 ), (6 , 7 ), (8 , 9 ), (10 , 11 ), (12 , 13 ), (14 , 15 ), (16 , 17 ), (18 , 19 )])
352352
353353 def test_array2d_tuple_iter_c (self ) -> None :
354354 a1 = np .array ([['aaa' , 'bb' ], ['c' , 'dd' ], ['ee' , 'fffff' ]])
355- it = array2d_tuple_iter (a1 )
355+ it = array_to_tuple_iter (a1 )
356356 self .assertEqual (it .__length_hint__ (), 3 )
357357 self .assertEqual (next (it ), ('aaa' , 'bb' ))
358358 self .assertEqual (it .__length_hint__ (), 2 )
@@ -365,48 +365,48 @@ def test_array2d_tuple_iter_c(self) -> None:
365365
366366 def test_array2d_tuple_iter_d (self ) -> None :
367367 a1 = np .array ([['aaa' , 'bb' ], ['c' , 'dd' ], ['ee' , 'fffff' ]])
368- it = array2d_tuple_iter (a1 )
368+ it = array_to_tuple_iter (a1 )
369369 # __reversed__ not implemented
370370 with self .assertRaises (TypeError ):
371371 reversed (it )
372372
373373 def test_array2d_tuple_iter_e (self ) -> None :
374374 a1 = np .array ([[None , 'bb' ], [None , 'dd' ], [3 , None ]])
375- it = array2d_tuple_iter (a1 )
375+ it = array_to_tuple_iter (a1 )
376376 del a1
377377 self .assertEqual (list (it ), [(None , 'bb' ), (None , 'dd' ), (3 , None )])
378378
379379 def test_array2d_tuple_iter_f (self ) -> None :
380380 a1 = np .array ([[None , 'bb' ], [None , 'dd' ], [3 , None ]])
381- it1 = array2d_tuple_iter (a1 )
381+ it1 = array_to_tuple_iter (a1 )
382382 del a1
383383 it2 = iter (it1 )
384384 self .assertEqual (list (it1 ), [(None , 'bb' ), (None , 'dd' ), (3 , None )])
385385 self .assertEqual (list (it2 ), []) # expected behavior
386386
387387 def test_array2d_tuple_iter_g (self ) -> None :
388388 a1 = np .array ([[None , 'bb' ], [None , 'dd' ], [3 , None ]])
389- it1 = array2d_tuple_iter (a1 )
390- it2 = array2d_tuple_iter (a1 )
389+ it1 = array_to_tuple_iter (a1 )
390+ it2 = array_to_tuple_iter (a1 )
391391 del a1
392392 self .assertEqual (list (it1 ), [(None , 'bb' ), (None , 'dd' ), (3 , None )])
393393 self .assertEqual (list (it2 ), [(None , 'bb' ), (None , 'dd' ), (3 , None )])
394394
395395 def test_array2d_tuple_iter_1d_a (self ) -> None :
396396 a1 = np .array (['bb' , 'c' , 'aaa' ])
397- result = list (array2d_tuple_iter (a1 ))
397+ result = list (array_to_tuple_iter (a1 ))
398398 self .assertEqual (len (result ), 3 )
399399 self .assertEqual (result , [('bb' ,), ('c' ,), ('aaa' ,)])
400400
401401 def test_array2d_tuple_iter_1d_b (self ) -> None :
402402 a1 = np .array ([20 , - 1 , 8 ])
403- result = list (array2d_tuple_iter (a1 ))
403+ result = list (array_to_tuple_iter (a1 ))
404404 self .assertEqual (len (result ), 3 )
405405 self .assertEqual (result , [(20 ,), (- 1 ,), (8 ,)])
406406
407407 def test_array2d_tuple_iter_1d_c (self ) -> None :
408408 a1 = np .array ([('a' , 4 ), ('c' , - 1 ), ('d' , 8 )], dtype = object )
409- result = list (array2d_tuple_iter (a1 ))
409+ result = list (array_to_tuple_iter (a1 ))
410410 self .assertEqual (len (result ), 3 )
411411 self .assertEqual (result , [('a' , 4 ), ('c' , - 1 ), ('d' , 8 )])
412412
0 commit comments