@@ -425,6 +425,18 @@ def test_fill_readonly(self):
425
425
with pytest .raises (ValueError , match = ".*read-only" ):
426
426
a .fill (0 )
427
427
428
+ def test_fill_subarrays (self ):
429
+ # NOTE:
430
+ # This is also a regression test for a crash with PYTHONMALLOC=debug
431
+
432
+ dtype = np .dtype ("2<i8, 2<i8, 2<i8" )
433
+ data = ([1 , 2 ], [3 , 4 ], [5 , 6 ])
434
+
435
+ arr = np .empty (1 , dtype = dtype )
436
+ arr .fill (data )
437
+
438
+ assert_equal (arr , np .array (data , dtype = dtype ))
439
+
428
440
429
441
class TestArrayConstruction :
430
442
def test_array (self ):
@@ -3509,17 +3521,17 @@ def test_put(self):
3509
3521
bad_array = [1 , 2 , 3 ]
3510
3522
assert_raises (TypeError , np .put , bad_array , [0 , 2 ], 5 )
3511
3523
3512
- # when calling np.put, make sure an
3513
- # IndexError is raised if the
3524
+ # when calling np.put, make sure an
3525
+ # IndexError is raised if the
3514
3526
# array is empty
3515
3527
empty_array = np .asarray (list ())
3516
- with pytest .raises (IndexError ,
3528
+ with pytest .raises (IndexError ,
3517
3529
match = "cannot replace elements of an empty array" ):
3518
3530
np .put (empty_array , 1 , 1 , mode = "wrap" )
3519
- with pytest .raises (IndexError ,
3531
+ with pytest .raises (IndexError ,
3520
3532
match = "cannot replace elements of an empty array" ):
3521
3533
np .put (empty_array , 1 , 1 , mode = "clip" )
3522
-
3534
+
3523
3535
3524
3536
def test_ravel (self ):
3525
3537
a = np .array ([[0 , 1 ], [2 , 3 ]])
0 commit comments