|
| 1 | +from typing import Any |
| 2 | + |
1 | 3 | import numpy as np
|
2 |
| -from numpy import typing as npt # noqa: F401 |
3 | 4 | import pandas as pd
|
4 | 5 | from typing_extensions import assert_type
|
5 | 6 |
|
@@ -76,18 +77,22 @@ def test_mul_numpy_array() -> None:
|
76 | 77 | # `numpy` typing gives the corresponding `ndarray`s in the static type
|
77 | 78 | # checking, where our `__rmul__` cannot override. At runtime, they return
|
78 | 79 | # `Series`s.
|
79 |
| - # `mypy` thinks the return types are `Any`, which is a bug. |
| 80 | + # microsoft/pyright#10924 |
80 | 81 | check(
|
81 |
| - assert_type(b * left_i, "npt.NDArray[np.bool_]"), pd.Series # type: ignore[assert-type] |
| 82 | + assert_type(b * left_i, Any), # pyright: ignore[reportAssertTypeFailure] |
| 83 | + pd.Series, |
82 | 84 | )
|
83 | 85 | check(
|
84 |
| - assert_type(i * left_i, "npt.NDArray[np.int64]"), pd.Series # type: ignore[assert-type] |
| 86 | + assert_type(i * left_i, Any), # pyright: ignore[reportAssertTypeFailure] |
| 87 | + pd.Series, |
85 | 88 | )
|
86 | 89 | check(
|
87 |
| - assert_type(f * left_i, "npt.NDArray[np.float64]"), pd.Series # type: ignore[assert-type] |
| 90 | + assert_type(f * left_i, Any), # pyright: ignore[reportAssertTypeFailure] |
| 91 | + pd.Series, |
88 | 92 | )
|
89 | 93 | check(
|
90 |
| - assert_type(c * left_i, "npt.NDArray[np.complex128]"), pd.Series # type: ignore[assert-type] |
| 94 | + assert_type(c * left_i, Any), # pyright: ignore[reportAssertTypeFailure] |
| 95 | + pd.Series, |
91 | 96 | )
|
92 | 97 |
|
93 | 98 | check(assert_type(left_i.mul(b), pd.Series), pd.Series)
|
|
0 commit comments