Skip to content

Commit b8331c8

Browse files
GH1089 PR Feedback
1 parent dc97df1 commit b8331c8

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

tests/test_frame.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,8 +2453,7 @@ def test_sum_get_add() -> None:
24532453
def test_getset_untyped() -> None:
24542454
df = pd.DataFrame({"x": [1, 2, 3, 4, 5], "y": [10, 20, 30, 40, 50]})
24552455
# Tests that Dataframe.__getitem__ needs to return untyped series.
2456-
# TODO this typecheck is actually bogus as the right part is "Unknown"
2457-
result: pd.Series = df["x"].max()
2456+
check(assert_type(df["x"].max(), Any), np.integer)
24582457

24592458

24602459
def test_getmultiindex_columns() -> None:
@@ -2965,8 +2964,7 @@ def sum_mean(x: pd.DataFrame) -> float:
29652964
pd.Series,
29662965
)
29672966

2968-
def lfunc(x: pd.DataFrame) -> float:
2969-
return x.sum().mean()
2967+
lfunc: Callable[[pd.DataFrame], float] = lambda x: x.sum().mean()
29702968

29712969
with pytest_warns_bounded(
29722970
DeprecationWarning,

tests/test_series.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def test_types_drop_multilevel() -> None:
312312
check(
313313
assert_type(s.drop(labels="first", level=1), "pd.Series[int]"),
314314
pd.Series,
315-
np.int64,
315+
np.integer,
316316
)
317317

318318

@@ -389,7 +389,7 @@ def test_types_sort_index_with_key() -> None:
389389
check(
390390
assert_type(s.sort_index(key=lambda k: k.str.lower()), "pd.Series[int]"),
391391
pd.Series,
392-
np.int64,
392+
np.integer,
393393
)
394394

395395

@@ -1147,8 +1147,10 @@ def test_types_getitem() -> None:
11471147
s = pd.Series({"key": [0, 1, 2, 3]})
11481148
key: list[int] = s["key"]
11491149
s2 = pd.Series([0, 1, 2, 3])
1150+
check(assert_type(s[0], Any), np.integer)
11501151
check(assert_type(s2[0], int), np.integer)
11511152
check(assert_type(s[:2], pd.Series), pd.Series)
1153+
check(assert_type(s2[:2], "pd.Series[int]"), pd.Series, np.integer)
11521154

11531155

11541156
def test_types_getitem_by_timestamp() -> None:
@@ -1306,9 +1308,9 @@ def test_types_dot() -> None:
13061308
s2 = pd.Series([-1, 2, -3, 4])
13071309
df1 = pd.DataFrame([[0, 1], [-2, 3], [4, -5], [6, 7]])
13081310
n1 = np.array([[0, 1], [1, 2], [-1, -1], [2, 0]])
1309-
check(assert_type(s1.dot(s2), Scalar), np.int64)
1310-
check(assert_type(s1 @ s2, Scalar), np.int64)
1311-
check(assert_type(s1.dot(df1), "pd.Series[int]"), pd.Series, np.int64)
1311+
check(assert_type(s1.dot(s2), Scalar), np.integer)
1312+
check(assert_type(s1 @ s2, Scalar), np.integer)
1313+
check(assert_type(s1.dot(df1), "pd.Series[int]"), pd.Series, np.integer)
13121314
check(assert_type(s1 @ df1, pd.Series), pd.Series)
13131315
check(assert_type(s1.dot(n1), np.ndarray), np.ndarray)
13141316
check(assert_type(s1 @ n1, np.ndarray), np.ndarray)

0 commit comments

Comments
 (0)