@@ -94,7 +94,9 @@ def test_large_string_pyarrow():
9494 tm .assert_frame_equal (result , expected )
9595
9696 # check round-trip
97- assert pa .Table .equals (pa .interchange .from_dataframe (result ), table )
97+ # Don't check stacklevel as PyArrow calls the deprecated `__dataframe__` method.
98+ with tm .assert_produces_warning (match = "Interchange" , check_stacklevel = False ):
99+ assert pa .Table .equals (pa .interchange .from_dataframe (result ), table )
98100
99101
100102@pytest .mark .parametrize (
@@ -121,6 +123,7 @@ def test_bitmasks_pyarrow(offset, length, expected_values):
121123 tm .assert_frame_equal (result , expected )
122124
123125 # check round-trip
126+ # Don't check stacklevel as PyArrow calls the deprecated `__dataframe__` method.
124127 with tm .assert_produces_warning (match = "Interchange" , check_stacklevel = False ):
125128 assert pa .Table .equals (pa .interchange .from_dataframe (result ), table )
126129
@@ -297,7 +300,9 @@ def test_empty_pyarrow(data):
297300 from pyarrow .interchange import from_dataframe as pa_from_dataframe
298301
299302 expected = pd .DataFrame (data )
300- arrow_df = pa_from_dataframe (expected )
303+ # Don't check stacklevel as PyArrow calls the deprecated `__dataframe__` method.
304+ with tm .assert_produces_warning (match = "Interchange" , check_stacklevel = False ):
305+ arrow_df = pa_from_dataframe (expected )
301306 result = from_dataframe (arrow_df )
302307 tm .assert_frame_equal (result , expected , check_column_type = False )
303308
@@ -441,7 +446,8 @@ def test_large_string():
441446 # GH#56702
442447 pytest .importorskip ("pyarrow" )
443448 df = pd .DataFrame ({"a" : ["x" ]}, dtype = "large_string[pyarrow]" )
444- with tm .assert_produces_warning (match = "Interchange" ):
449+ # Don't check stacklevel as PyArrow calls the deprecated `__dataframe__` method.
450+ with tm .assert_produces_warning (match = "Interchange" , check_stacklevel = False ):
445451 result = pd .api .interchange .from_dataframe (df .__dataframe__ ())
446452 expected = pd .DataFrame ({"a" : ["x" ]}, dtype = "str" )
447453 tm .assert_frame_equal (result , expected )
0 commit comments