Skip to content

Commit 635e056

Browse files
Skip NaT input on np.median test for np=1.21.
As title. See: numpy/numpy#20376
1 parent 4df2640 commit 635e056

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎numba/tests/test_array_reductions.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,11 @@ def _do_check_nptimedelta(self, pyfunc, arr):
686686
np.random.shuffle(arr)
687687
self.assertPreciseEqual(cfunc(arr), pyfunc(arr))
688688
# Test with a NaT
689-
arr[arr.size // 2] = 'NaT'
690-
self.assertPreciseEqual(cfunc(arr), pyfunc(arr))
689+
if numpy_version != (1, 21) and 'median' not in pyfunc.__name__:
690+
# There's problems with NaT handling in "median" on at least NumPy
691+
# 1.21.{3, 4}. See https://github.com/numpy/numpy/issues/20376
692+
arr[arr.size // 2] = 'NaT'
693+
self.assertPreciseEqual(cfunc(arr), pyfunc(arr))
691694
if 'median' not in pyfunc.__name__:
692695
# Test with (val, NaT)^N (and with the random NaT from above)
693696
# use a loop, there's some weird thing/bug with arr[1::2] = 'NaT'

0 commit comments

Comments
 (0)