File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1387,3 +1387,22 @@ def test_compress_empty_axis(self):
1387
1387
# non-empty take from empty axis raises IndexError
1388
1388
with pytest .raises (IndexError ):
1389
1389
dpnp .compress (condition , a , axis = 1 )
1390
+
1391
+ def test_compress_in_overlaps_out (self ):
1392
+ conditions = [False , True , True ]
1393
+ a_np = numpy .arange (6 )
1394
+ a = dpnp .arange (6 )
1395
+ cond_np = numpy .array (conditions )
1396
+ cond = dpnp .array (conditions )
1397
+ out = a [2 :4 ]
1398
+ expected = numpy .compress (cond_np , a_np , axis = None )
1399
+ result = dpnp .compress (cond , a , axis = None , out = out )
1400
+ assert_array_equal (expected , result )
1401
+ assert result is out
1402
+ assert (a [2 :4 ] == out ).all ()
1403
+
1404
+ def test_compress_condition_not_1d (self ):
1405
+ a = dpnp .arange (4 )
1406
+ cond = dpnp .ones ((1 , 4 ), dtype = "?" )
1407
+ with pytest .raises (ValueError ):
1408
+ dpnp .compress (cond , a , axis = None )
You can’t perform that action at this time.
0 commit comments