Skip to content

Commit 0b6a543

Browse files
committed
catch warning with ArrayManager
1 parent ee4ae8f commit 0b6a543

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pandas/tests/frame/methods/test_append.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,16 @@ def test_append_timestamps_aware_or_naive(self, tz_naive_fixture, timestamp):
231231
([1], pd.SparseDtype()),
232232
],
233233
)
234-
def test_other_dtypes(self, data, dtype):
234+
def test_other_dtypes(self, data, dtype, using_array_manager):
235235
df = DataFrame(data, dtype=dtype)
236-
result = df._append(df.iloc[0]).iloc[-1]
236+
237+
warn = None
238+
if using_array_manager and isinstance(dtype, pd.SparseDtype):
239+
warn = FutureWarning
240+
241+
with tm.assert_produces_warning(warn, match="astype from SparseDtype"):
242+
result = df._append(df.iloc[0]).iloc[-1]
243+
237244
expected = Series(data, name=0, dtype=dtype)
238245
tm.assert_series_equal(result, expected)
239246

0 commit comments

Comments
 (0)