File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1355,11 +1355,9 @@ def object_dtype(request):
1355
1355
@pytest .fixture (
1356
1356
params = [
1357
1357
np .dtype ("object" ),
1358
- pd .StringDtype ("python" ),
1359
- pytest .param (pd .StringDtype ("pyarrow" ), marks = td .skip_if_no ("pyarrow" )),
1360
- pytest .param (
1361
- pd .StringDtype ("pyarrow" , na_value = np .nan ), marks = td .skip_if_no ("pyarrow" )
1362
- ),
1358
+ ("python" , pd .NA ),
1359
+ pytest .param (("pyarrow" , pd .NA ), marks = td .skip_if_no ("pyarrow" )),
1360
+ pytest .param (("pyarrow" , np .nan ), marks = td .skip_if_no ("pyarrow" )),
1363
1361
],
1364
1362
ids = [
1365
1363
"string=object" ,
@@ -1376,7 +1374,13 @@ def any_string_dtype(request):
1376
1374
* 'string[pyarrow]' (NA variant)
1377
1375
* 'str' (NaN variant, with pyarrow)
1378
1376
"""
1379
- return request .param
1377
+ if isinstance (request .param , np .dtype ):
1378
+ return request .param
1379
+ else :
1380
+ # need to instantiate the StringDtype here instead of in the params
1381
+ # to avoid importing pyarrow during test collection
1382
+ storage , na_value = request .param
1383
+ return pd .StringDtype (storage , na_value )
1380
1384
1381
1385
1382
1386
@pytest .fixture (params = tm .DATETIME64_DTYPES )
You can’t perform that action at this time.
0 commit comments