Skip to content

Commit 748596d

Browse files
committed
fix the unused variable in the test_setops.py
1 parent bcf1e0d commit 748596d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

pandas/tests/indexes/multi/test_setops.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,25 @@ def test_multiindex_difference_pyarrow_timestamp():
225225
# Verify the result
226226
assert len(new_idx) == 1
227227
assert idx_val not in new_idx
228-
assert new_idx.equals(MultiIndex.from_tuples([(2, pd.Timestamp("1900-01-01"))]))
228+
229+
# Create expected index with the same PyArrow timestamp dtype
230+
expected_df = (
231+
DataFrame(
232+
[(2, "1900-01-01", "b")],
233+
columns=["id", "date", "val"],
234+
)
235+
.astype(
236+
{
237+
"id": "int64[pyarrow]",
238+
"date": "timestamp[ns][pyarrow]",
239+
"val": "string[pyarrow]",
240+
}
241+
)
242+
.set_index(["id", "date"])
243+
)
244+
expected = expected_df.index
245+
246+
assert new_idx.equals(expected)
229247

230248

231249
def test_difference_sort_special():

0 commit comments

Comments
 (0)