Skip to content

Commit 902601f

Browse files
committed
revised testing to resolve CI errors v2
1 parent c0d8178 commit 902601f

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

pandas/tests/frame/methods/test_convert_dtypes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import numpy as np
44
import pytest
55

6+
import pandas.util._test_decorators as td
7+
68
import pandas as pd
79
import pandas._testing as tm
810

@@ -35,7 +37,7 @@ def test_convert_empty(self):
3537
empty_df = pd.DataFrame()
3638
tm.assert_frame_equal(empty_df, empty_df.convert_dtypes())
3739

38-
@tm.skip_if_no("pyarrow")
40+
@td.skip_if_no("pyarrow")
3941
def test_convert_empty_categorical_to_pyarrow(self):
4042
# GH#59934
4143
df = pd.DataFrame(
@@ -51,11 +53,9 @@ def test_convert_empty_categorical_to_pyarrow(self):
5153
assert converted.A.dtype == "category", "Dtype in column A is not 'category'"
5254
assert converted.B.dtype == "category", "Dtype in column B is not 'category'"
5355
assert converted.A.cat.categories.empty, "Categories in column A are not empty"
54-
assert converted.B.cat.categories.__contains__(
55-
"B1"
56-
) and converted.B.cat.categories.__contains__(
57-
"B2"
58-
), "Categories in column B doesn't contain adequate categories"
56+
assert converted.B.cat.categories.isin(
57+
["B1", "B2"]
58+
).all(), "Categories in column B doesn't contain adequate categories"
5959

6060
def test_convert_dtypes_retain_column_names(self):
6161
# GH#41435

pandas/tests/series/methods/test_convert_dtypes.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pytest
55

66
from pandas._libs import lib
7+
import pandas.util._test_decorators as td
78

89
import pandas as pd
910
import pandas._testing as tm
@@ -298,7 +299,7 @@ def test_convert_dtypes_pyarrow_null(self):
298299
expected = pd.Series([None, None], dtype=pd.ArrowDtype(pa.null()))
299300
tm.assert_series_equal(result, expected)
300301

301-
@tm.skip_if_no("pyarrow")
302+
@td.skip_if_no("pyarrow")
302303
def test_convert_empty_categorical_to_pyarrow(self):
303304
# GH#59934
304305
ser1 = pd.Series(pd.Categorical([None] * 5))
@@ -311,8 +312,6 @@ def test_convert_empty_categorical_to_pyarrow(self):
311312

312313
ser2 = pd.Series(pd.Categorical([None] * 5, categories=["S1", "S2"]))
313314
converted2 = ser2.convert_dtypes(dtype_backend="pyarrow")
314-
assert converted2.cat.categories.__contains__(
315-
"S1"
316-
) and converted2.cat.categories.__contains__(
317-
"S2"
318-
), "Categories in ser2 doesn't contain adequate categories"
315+
assert converted2.cat.categories.isin(
316+
["S1", "S2"]
317+
).all(), "Categories in ser2 doesn't contain adequate categories"

0 commit comments

Comments
 (0)