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 3
3
import numpy as np
4
4
import pytest
5
5
6
+ import pandas .util ._test_decorators as td
7
+
6
8
import pandas as pd
7
9
import pandas ._testing as tm
8
10
@@ -35,7 +37,7 @@ def test_convert_empty(self):
35
37
empty_df = pd .DataFrame ()
36
38
tm .assert_frame_equal (empty_df , empty_df .convert_dtypes ())
37
39
38
- @tm .skip_if_no ("pyarrow" )
40
+ @td .skip_if_no ("pyarrow" )
39
41
def test_convert_empty_categorical_to_pyarrow (self ):
40
42
# GH#59934
41
43
df = pd .DataFrame (
@@ -51,11 +53,9 @@ def test_convert_empty_categorical_to_pyarrow(self):
51
53
assert converted .A .dtype == "category" , "Dtype in column A is not 'category'"
52
54
assert converted .B .dtype == "category" , "Dtype in column B is not 'category'"
53
55
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"
59
59
60
60
def test_convert_dtypes_retain_column_names (self ):
61
61
# GH#41435
Original file line number Diff line number Diff line change 4
4
import pytest
5
5
6
6
from pandas ._libs import lib
7
+ import pandas .util ._test_decorators as td
7
8
8
9
import pandas as pd
9
10
import pandas ._testing as tm
@@ -298,7 +299,7 @@ def test_convert_dtypes_pyarrow_null(self):
298
299
expected = pd .Series ([None , None ], dtype = pd .ArrowDtype (pa .null ()))
299
300
tm .assert_series_equal (result , expected )
300
301
301
- @tm .skip_if_no ("pyarrow" )
302
+ @td .skip_if_no ("pyarrow" )
302
303
def test_convert_empty_categorical_to_pyarrow (self ):
303
304
# GH#59934
304
305
ser1 = pd .Series (pd .Categorical ([None ] * 5 ))
@@ -311,8 +312,6 @@ def test_convert_empty_categorical_to_pyarrow(self):
311
312
312
313
ser2 = pd .Series (pd .Categorical ([None ] * 5 , categories = ["S1" , "S2" ]))
313
314
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