8000 TST: Fix up tests which relied directly on int -> timdelta "promotion" · numpy/numpy@b054f57 · GitHub
[go: up one dir, main page]

Skip to content

Commit b054f57

Browse files
committed
TST: Fix up tests which relied directly on int -> timdelta "promotion"
1 parent 58aee85 commit b054f57

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

numpy/core/tests/test_dtype.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,10 +1806,10 @@ def test_subscript_scalar(self) -> None:
18061806
def test_result_type_integers_and_unitless_timedelta64():
18071807
# Regression test for gh-20077. The following call of `result_type`
18081808
# would cause a seg. fault.
1809+
# This was allowed initially, but times should not promote with ints.
18091810
td = np.timedelta64(4)
1810-
result = np.result_type(0, td)
1811-
assert_dtype_equal(result, td.dtype)
1812-
1811+
with pytest.raises(TypeError):
1812+
np.result_type(0, td)
18131813

18141814
@pytest.mark.skipif(sys.version_info >= (3, 9), reason="Requires python 3.8")
18151815
def test_class_getitem_38() -> None:

numpy/core/tests/test_numeric.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,8 +2349,8 @@ def test_clip_value_min_max_flip(self, amin, amax):
23492349
# for bugs in NPY_TIMEDELTA_MAX, based on a case
23502350
# produced by hypothesis
23512351
(np.zeros(10, dtype='m8') - 1,
2352-
0,
2353-
0,
2352+
np.timedelta64(0),
2353+
np.timedelta64(0),
23542354
np.zeros(10, dtype='m8')),
23552355
])
23562356
def test_clip_problem_cases(self, arr, amin, amax, exp):

0 commit comments

Comments
 (0)
0