Skip to content

Commit e7f4de6

Browse files
author
Marco Gorelli
committed
✅ Test DataFrame.append with other dtypes
1 parent db062da commit e7f4de6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pandas/tests/frame/methods/test_append.py

+16
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,19 @@ def test_append_timestamps_aware_or_naive(self, tz_naive_fixture, timestamp):
177177
result = df.append(df.iloc[0]).iloc[-1]
178178
expected = pd.Series(pd.Timestamp(timestamp, tz=tz), name=0)
179179
tm.assert_series_equal(result, expected)
180+
181+
@pytest.mark.parametrize(
182+
"data, dtype",
183+
[
184+
([1], pd.Int64Dtype()),
185+
([1], pd.CategoricalDtype()),
186+
([pd.Interval(left=0, right=5)], pd.IntervalDtype()),
187+
([pd.Period("2000-03", freq="M")], pd.PeriodDtype("M")),
188+
([1], pd.SparseDtype()),
189+
],
190+
)
191+
def test_other_dtypes(self, data, dtype):
192+
df = pd.DataFrame(data, dtype=dtype)
193+
result = df.append(df.iloc[0]).iloc[-1]
194+
expected = pd.Series(data, name=0, dtype=dtype)
195+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)