File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change 33import numpy as np
44import pytest
55
6+ import pandas .util ._test_decorators as td
7+
68import pandas as pd
79import 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
Original file line number Diff line number Diff line change 44import pytest
55
66from pandas ._libs import lib
7+ import pandas .util ._test_decorators as td
78
89import pandas as pd
910import 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"
You can’t perform that action at this time.
0 commit comments