88import pytest
99
1010import narwhals as nw
11- from tests .utils import ConstructorEager , assert_equal_data
11+ from tests .utils import PANDAS_VERSION , ConstructorEager , assert_equal_data
1212
1313if TYPE_CHECKING :
1414 from narwhals .typing import _1DArray
@@ -301,9 +301,12 @@ def test_triple_tuple(constructor_eager: ConstructorEager) -> None:
301301def test_slice_with_series (
302302 constructor_eager : ConstructorEager , request : pytest .FixtureRequest
303303) -> None :
304- if "pandas_pyarrow" in str (constructor_eager ):
305- # https://github.com/pandas-dev/pandas/issues/61311
306- request .applymarker (pytest .mark .xfail )
304+ request .applymarker (
305+ pytest .mark .xfail (
306+ "pandas_pyarrow" in str (constructor_eager ) and PANDAS_VERSION < (3 ,),
307+ reason = "https://github.com/pandas-dev/pandas/issues/61311" ,
308+ )
309+ )
307310 data = {"a" : [1 , 2 , 3 ], "c" : [0 , 2 , 1 ]}
308311 nw_df = nw .from_native (constructor_eager (data ), eager_only = True )
309312 result = nw_df [nw_df ["c" ]]
@@ -325,9 +328,12 @@ def test_horizontal_slice_with_series(constructor_eager: ConstructorEager) -> No
325328def test_horizontal_slice_with_series_2 (
326329 constructor_eager : ConstructorEager , request : pytest .FixtureRequest
327330) -> None :
328- if "pandas_pyarrow" in str (constructor_eager ):
329- # https://github.com/pandas-dev/pandas/issues/61311
330- request .applymarker (pytest .mark .xfail )
331+ request .applymarker (
332+ pytest .mark .xfail (
333+ "pandas_pyarrow" in str (constructor_eager ) and PANDAS_VERSION < (3 ,),
334+ reason = "https://github.com/pandas-dev/pandas/issues/61311" ,
335+ )
336+ )
331337 data = {"a" : [1 , 2 ], "c" : [0 , 2 ], "d" : ["c" , "a" ]}
332338 nw_df = nw .from_native (constructor_eager (data ), eager_only = True )
333339 result = nw_df [:, nw_df ["c" ]]
0 commit comments