MCPcopy Create free account
hub / github.com/numpy/numpy / test_sort_degraded

Method test_sort_degraded

numpy/core/tests/test_multiarray.py:2242–2255  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2240 assert_raises(TypeError, arr.sort, kind=kind)
2241
2242 def test_sort_degraded(self):
2243 # test degraded dataset would take minutes to run with normal qsort
2244 d = np.arange(1000000)
2245 do = d.copy()
2246 x = d
2247 # create a median of 3 killer where each median is the sorted second
2248 # last element of the quicksort partition
2249 while x.size > 3:
2250 mid = x.size // 2
2251 x[mid], x[-2] = x[-2], x[mid]
2252 x = x[:-2]
2253
2254 assert_equal(np.sort(d), do)
2255 assert_equal(d[np.argsort(d)], do)
2256
2257 def test_copy(self):
2258 def assert_fortran(arr):

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.90
sortMethod · 0.80
copyMethod · 0.45
argsortMethod · 0.45

Tested by

no test coverage detected