@@ -384,22 +384,32 @@ def test_dtype_from_element_str_and_bytes_dtypes(self) -> None:
384
384
385
385
def test_get_new_indexers_and_screen_a (self ) -> None :
386
386
indexersA = np .array ([9 , 9 , 9 , 9 , 0 , 0 , 1 , 4 , 5 , 0 , 0 , 0 , 1 ], dtype = np .int64 )
387
- postB = get_new_indexers_and_screen_ak (indexersA , np .arange (10 , dtype = np .int64 ))
388
- assert tuple (map (list , postB )) == (
387
+ postA = get_new_indexers_and_screen_ak (indexersA , np .arange (10 , dtype = np .int64 ))
388
+ assert indexersA .flags .c_contiguous
389
+ assert indexersA .flags .f_contiguous
390
+ assert tuple (map (list , postA )) == (
389
391
[0 , 0 , 0 , 0 , 1 , 1 , 2 , 3 , 4 , 1 , 1 , 1 , 2 ],
390
392
[9 , 0 , 1 , 4 , 5 ],
391
393
)
392
394
393
- indexersB = np .array ([9 , 9 , 9 , 9 , 0 , 0 , 1 , 4 , 5 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ], dtype = np .int64 )
394
- postB = get_new_indexers_and_screen_ak (indexersB , positions = np .arange (15 , dtype = np .int64 ))
395
- assert tuple (map (list , postB )) == (
395
+ # Prove we can handle non-continuous arrays
396
+ indexersB = np .full ((len (indexersA ), 3 ), - 1 )
397
+ indexersB [:,1 ] = indexersA .copy ()
398
+ assert not indexersB [:,1 ].flags .c_contiguous
399
+ assert not indexersB [:,1 ].flags .f_contiguous
400
+ postB = get_new_indexers_and_screen_ak (indexersB [:,1 ], np .arange (10 , dtype = np .int64 ))
401
+ assert tuple (map (list , postA )) == tuple (map (list , postB ))
402
+
403
+ indexersC = np .array ([9 , 9 , 9 , 9 , 0 , 0 , 1 , 4 , 5 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ], dtype = np .int64 )
404
+ postC = get_new_indexers_and_screen_ak (indexersC , positions = np .arange (15 , dtype = np .int64 ))
405
+ assert tuple (map (list , postC )) == (
396
406
[0 , 0 , 0 , 0 , 1 , 1 , 2 , 3 , 4 , 1 , 1 , 1 , 2 , 5 , 6 , 3 , 4 ,7 , 8 , 9 , 0 , 10 ],
397
407
[9 , 0 , 1 , 4 , 5 , 2 , 3 , 6 , 7 , 8 , 10 ],
398
408
)
399
409
400
- indexersC = np .array ([2 , 1 , 0 , 2 , 0 , 1 , 1 , 2 , 0 ], dtype = np .int64 )
401
- postC = get_new_indexers_and_screen_ak (indexers = indexersC , positions = np .arange (3 , dtype = np .int64 ))
402
- assert tuple (map (list , postC )) == (
410
+ indexersD = np .array ([2 , 1 , 0 , 2 , 0 , 1 , 1 , 2 , 0 ], dtype = np .int64 )
411
+ postD = get_new_indexers_and_screen_ak (indexers = indexersD , positions = np .arange (3 , dtype = np .int64 ))
412
+ assert tuple (map (list , postD )) == (
403
413
[2 , 1 , 0 , 2 , 0 , 1 , 1 , 2 , 0 ],
404
414
[0 , 1 , 2 ],
405
415
)
0 commit comments