@@ -341,7 +341,7 @@ def test_broadcast_shapes_raises():
341
341
[(2 , 3 ), (2 ,)],
342
342
[(3 ,), (3 ,), (4 ,)],
343
343
[(1 , 3 , 4 ), (2 , 3 , 3 )],
344
- [(1 , 2 ), (3 ,1 ), (3 ,2 ), (10 , 5 )],
344
+ [(1 , 2 ), (3 , 1 ), (3 , 2 ), (10 , 5 )],
345
345
[2 , (2 , 3 )],
346
346
]
347
347
for input_shapes in data :
@@ -578,11 +578,12 @@ def test_writeable():
578
578
579
579
# but the result of broadcast_arrays needs to be writeable, to
580
580
# preserve backwards compatibility
581
- for is_broadcast , results in [(False , broadcast_arrays (original ,)),
582
- (True , broadcast_arrays (0 , original ))]:
583
- for result in results :
581
+ test_cases = [((False ,), broadcast_arrays (original ,)),
582
+ ((True , False ), broadcast_arrays (0 , original ))]
583
+ for is_broadcast , results in test_cases :
584
+ for array_is_broadcast , result in zip (is_broadcast , results ):
584
585
# This will change to False in a future version
585
- if is_broadcast :
586
+ if array_is_broadcast :
586
587
with assert_warns (FutureWarning ):
587
588
assert_equal (result .flags .writeable , True )
588
589
with assert_warns (DeprecationWarning ):
@@ -623,11 +624,12 @@ def test_writeable_memoryview():
623
624
# See gh-13929.
624
625
original = np .array ([1 , 2 , 3 ])
625
626
626
- for is_broadcast , results in [(False , broadcast_arrays (original ,)),
627
- (True , broadcast_arrays (0 , original ))]:
628
- for result in results :
627
+ test_cases = [((False , ), broadcast_arrays (original ,)),
628
+ ((True , False ), broadcast_arrays (0 , original ))]
629
+ for is_broadcast , results in test_cases :
630
+ for array_is_broadcast , result in zip (is_broadcast , results ):
629
631
# This will change to False in a future version
630
- if is_broadcast :
632
+ if array_is_broadcast :
631
633
# memoryview(result, writable=True) will give warning but cannot
632
634
# be tested using the python API.
633
635
assert memoryview (result ).readonly
0 commit comments