|
1 | | -from collections.abc import Generator |
| 1 | +from collections.abc import Callable, Generator |
2 | 2 | from contextlib import contextmanager |
3 | 3 | from importlib import import_module |
| 4 | +from typing import cast |
4 | 5 |
|
5 | 6 | import numpy as np |
6 | 7 | import pytest |
@@ -100,7 +101,8 @@ def test_update_ops( |
100 | 101 | pytest.skip("at() does not support updates on sparse arrays") |
101 | 102 |
|
102 | 103 | with assert_copy(array, expect_copy): |
103 | | - y = getattr(at(array)[1:], op)(arg, **kwargs) |
| 104 | + func = cast(Callable[..., Array], getattr(at(array)[1:], op)) # type: ignore[no-any-explicit] |
| 105 | + y = func(arg, **kwargs) |
104 | 106 | assert isinstance(y, type(array)) |
105 | 107 | assert_array_equal(y, expect) |
106 | 108 |
|
@@ -153,6 +155,6 @@ def test_iops_incompatible_dtype(op: str, copy: bool): |
153 | 155 | to dtype('int64') with casting rule 'same_kind' |
154 | 156 | """ |
155 | 157 | a = np.asarray([2, 4]) |
156 | | - func = getattr(at(a)[:], op) |
| 158 | + func = cast(Callable[..., Array], getattr(at(a)[:], op)) # type: ignore[no-any-explicit] |
157 | 159 | with pytest.raises(TypeError, match="Cannot cast ufunc"): |
158 | 160 | func(1.1, copy=copy) |
0 commit comments