Skip to content

Commit dff4d6e

Browse files
authored
chore: cleanup type errors in tests/system/small/test_index.py (#756)
1 parent d751f5c commit dff4d6e

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

tests/system/small/test_index.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,17 @@ def test_index_construct_from_list():
2424
bf_result = bpd.Index(
2525
[3, 14, 159], dtype=pd.Int64Dtype(), name="my_index"
2626
).to_pandas()
27-
# TODO(b/340878489): fix type error
28-
pd_result = pd.Index([3, 14, 159], dtype=pd.Int64Dtype(), name="my_index") # type: ignore
27+
pd_result: pd.Index = pd.Index([3, 14, 159], dtype=pd.Int64Dtype(), name="my_index")
2928
pd.testing.assert_index_equal(bf_result, pd_result)
3029

3130

3231
def test_index_construct_from_series():
33-
# TODO(b/340878489): fix type error
3432
bf_result = bpd.Index(
3533
bpd.Series([3, 14, 159], dtype=pd.Float64Dtype(), name="series_name"),
3634
name="index_name",
3735
dtype=pd.Int64Dtype(),
38-
).to_pandas() # type: ignore
39-
# TODO(b/340878489): fix type error
40-
pd_result = pd.Index( # type: ignore
36+
).to_pandas()
37+
pd_result: pd.Index = pd.Index(
4138
pd.Series([3, 14, 159], dtype=pd.Float64Dtype(), name="series_name"),
4239
name="index_name",
4340
dtype=pd.Int64Dtype(),
@@ -49,14 +46,15 @@ def test_index_construct_from_index():
4946
bf_index_input = bpd.Index(
5047
[3, 14, 159], dtype=pd.Float64Dtype(), name="series_name"
5148
)
52-
# TODO(b/340878489): fix type error
5349
bf_result = bpd.Index(
54-
bf_index_input, dtype=pd.Int64Dtype(), name="index_name" # type: ignore
50+
bf_index_input, dtype=pd.Int64Dtype(), name="index_name"
5551
).to_pandas()
56-
# TODO(b/340878489): fix type error
57-
pd_index_input = pd.Index([3, 14, 159], dtype=pd.Float64Dtype(), name="series_name") # type: ignore
58-
# TODO(b/340878489): fix type error
59-
pd_result = pd.Index(pd_index_input, dtype=pd.Int64Dtype(), name="index_name") # type: ignore
52+
pd_index_input: pd.Index = pd.Index(
53+
[3, 14, 159], dtype=pd.Float64Dtype(), name="series_name"
54+
)
55+
pd_result: pd.Index = pd.Index(
56+
pd_index_input, dtype=pd.Int64Dtype(), name="index_name"
57+
)
6058
pd.testing.assert_index_equal(bf_result, pd_result)
6159

6260

@@ -365,17 +363,16 @@ def test_index_drop_duplicates(scalars_df_index, scalars_pandas_df_index, keep):
365363

366364

367365
def test_index_isin(scalars_df_index, scalars_pandas_df_index):
366+
col_name = "int64_col"
368367
bf_series = (
369-
scalars_df_index.set_index("int64_col").index.isin([2, 55555, 4]).to_pandas()
368+
scalars_df_index.set_index(col_name).index.isin([2, 55555, 4]).to_pandas()
370369
)
371-
pd_result_array = scalars_pandas_df_index.set_index("int64_col").index.isin(
370+
pd_result_array = scalars_pandas_df_index.set_index(col_name).index.isin(
372371
[2, 55555, 4]
373372
)
374-
# TODO(b/340878489): fix type error
375-
pd.testing.assert_index_equal( # type: ignore
376-
pd.Index(pd_result_array),
373+
pd.testing.assert_index_equal(
374+
pd.Index(pd_result_array).set_names(col_name),
377375
bf_series,
378-
check_names=False,
379376
)
380377

381378

0 commit comments

Comments
 (0)