@@ -2965,10 +2965,12 @@ def test_partition(self):
2965
2965
# all after are larger
2966
2966
assert_array_less (p [i ], p [i + 1 :])
2967
2967
self .assert_partitioned (p , [i ])
2968
- self .assert_partitioned (d [np .argpartition (d , i , kind = k )], [i ])
2968
+ self .assert_partitioned (
2969
+ d [np .argpartition (d , i , kind = k )], [i ])
2969
2970
2970
2971
p = np .partition (d1 , i , axis = 1 , kind = k )
2971
- parg <
8000
span class=pl-c1>= d1 [np .arange (d1 .shape [0 ])[:, None ], np .argpartition (d1 , i , axis = 1 , kind = k )]
2972
+ parg = d1 [np .arange (d1 .shape [0 ])[:, None ],
2973
+ np .argpartition (d1 , i , axis = 1 , kind = k )]
2972
2974
aae (p [:, i ], np .array ([i ] * d1 .shape [0 ], dtype = dt ))
2973
2975
# array_less does not seem to work right
2974
2976
at ((p [:, :i ].T <= p [:, i ]).all (),
@@ -2980,16 +2982,17 @@ def test_partition(self):
2980
2982
self .assert_partitioned (parg [row ], [i ])
2981
2983
2982
2984
p = np .partition (d0 , i , axis = 0 , kind = k )
2983
- parg = d0 [np .argpartition (d0 , i , axis = 0 , kind = k ), np .arange (d0 .shape [1 ])[None , :]]
2985
+ parg = d0 [np .argpartition (d0 , i , axis = 0 , kind = k ),
2986
+ np .arange (d0 .shape [1 ])[None , :]]
2984
2987
aae (p [i , :], np .array ([i ] * d1 .shape [0 ], dtype = dt ))
2985
2988
# array_less does not seem to work right
2986
2989
at ((p [:i , :] <= p [i , :]).all (),
2987
2990
msg = "%d: %r <= %r" % (i , p [i , :], p [:i , :]))
2988
2991
at ((p [i + 1 :, :] > p [i , :]).all (),
2989
2992
msg = "%d: %r < %r" % (i , p [i , :], p [:, i + 1 :]))
2990
2993
for col in range (p .shape [1 ]):
2991
- self .assert_partitioned (p [:,col ], [i ])
2992
- self .assert_partitioned (parg [:,col ], [i ])
2994
+ self .assert_partitioned (p [:, col ], [i ])
2995
+ self .assert_partitioned (parg [:, col ], [i ])
2993
2996
2994
2997
# check inplace
2995
2998
dc = d .copy ()
@@ -3005,7 +3008,8 @@ def test_partition(self):
3005
3008
def assert_partitioned (self , d , kth ):
3006
3009
prev = 0
3007
3010
for k in np .sort (kth ):
3008
- assert_array_compare (operator .__le__ , d [prev :k ], d [k ], err_msg = 'kth %d' % k )
3011
+ assert_array_compare (operator .__le__ , d [prev :k ], d [k ],
3012
+ err_msg = 'kth %d' % k )
3009
3013
assert_ ((d [k :] >= d [k ]).all (),
3010
3014
msg = "kth %d, %r not greater equal %r" % (k , d [k :], d [k ]))
3011
3015
prev = k + 1
0 commit comments