Skip to content

Commit ff5e013

Browse files
committed
Fix pyright on Python 3.10
1 parent 252c7e9 commit ff5e013

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/test_scalars.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Any,
88
Literal,
99
Optional,
10+
cast,
1011
)
1112

1213
import dateutil.tz
@@ -1911,9 +1912,10 @@ def test_period_cmp_index() -> None:
19111912

19121913
def test_period_cmp_array() -> None:
19131914
p = pd.Period("2012-1-1", freq="D")
1914-
arr_nd: npt.NDArray[np.object_] = pd.period_range(
1915-
"2012-1-1", periods=4, freq="D"
1916-
).to_numpy()
1915+
arr_nd = cast( # cast to avoid pyright narrowing to a more precise shape
1916+
npt.NDArray[np.object_],
1917+
pd.period_range("2012-1-1", periods=4, freq="D").to_numpy(),
1918+
)
19171919
arr_2d = arr_nd.reshape(2, 2)
19181920

19191921
# >, <=

0 commit comments

Comments
 (0)