(N, dtype)
| 11312 | @pytest.mark.parametrize("N", np.arange(2, 512)) |
| 11313 | @pytest.mark.parametrize("dtype", [np.float16, np.float32, np.float64]) |
| 11314 | def test_partition_fp(N, dtype): |
| 11315 | rnd = np.random.RandomState(1100710816) |
| 11316 | arr = -0.5 + rnd.random(N).astype(dtype) |
| 11317 | k = rnd.choice(N, 1)[0] |
| 11318 | assert_arr_partitioned(np.sort(arr)[k], k, |
| 11319 | np.partition(arr, k, kind='introselect')) |
| 11320 | assert_arr_partitioned(np.sort(arr)[k], k, |
| 11321 | arr[np.argpartition(arr, k, kind='introselect')]) |
| 11322 | |
| 11323 | # Check that `np.inf < np.nan` |
| 11324 | # This follows np.sort |
| 11325 | arr[0] = np.nan |
| 11326 | arr[1] = np.inf |
| 11327 | o1 = np.partition(arr, -2, kind='introselect') |
| 11328 | o2 = arr[np.argpartition(arr, -2, kind='introselect')] |
| 11329 | for out in [o1, o2]: |
| 11330 | assert_(np.isnan(out[-1])) |
| 11331 | assert_equal(out[-2], np.inf) |
| 11332 | |
| 11333 | def test_cannot_assign_data(): |
| 11334 | a = np.arange(10) |
nothing calls this directly
no test coverage detected
searching dependent graphs…