Skip to content

Commit 84f075d

Browse files
TST: Moved test to different file pandas-dev#22558
1 parent f977a15 commit 84f075d

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

pandas/tests/apply/test_frame_apply.py

+18
Original file line numberDiff line numberDiff line change
@@ -1585,3 +1585,21 @@ def test_apply_on_empty_dataframe():
15851585
result = df.head(0).apply(lambda x: max(x["a"], x["b"]), axis=1)
15861586
expected = Series([])
15871587
tm.assert_series_equal(result, expected)
1588+
1589+
1590+
@pytest.mark.parametrize(
1591+
"test, constant",
1592+
[
1593+
({"a": [1, 2, 3], "b": [1, 1, 1]}, {"a": [1, 2, 3], "b": 1}),
1594+
({"a": [2, 2, 2], "b": [1, 1, 1]}, {"a": 2, "b": 1}),
1595+
],
1596+
)
1597+
def test_unique_agg_type_is_series(test, constant):
1598+
# GH#22558
1599+
df1 = DataFrame(test)
1600+
expected = Series(data=constant, index=["a", "b"], dtype="object")
1601+
aggregation = {"a": "unique", "b": "unique"}
1602+
1603+
result = df1.agg(aggregation)
1604+
1605+
tm.assert_series_equal(result, expected)

pandas/tests/util/test_assert_series_equal.py

-18
Original file line numberDiff line numberDiff line change
@@ -382,21 +382,3 @@ def test_assert_series_equal_identical_na(nulls_fixture):
382382
# while we're here do Index too
383383
idx = pd.Index(ser)
384384
tm.assert_index_equal(idx, idx.copy(deep=True))
385-
386-
387-
@pytest.mark.parametrize(
388-
"test, constant",
389-
[
390-
({"a": [1, 2, 3], "b": [1, 1, 1]}, {"a": [1, 2, 3], "b": 1}),
391-
({"a": [2, 2, 2], "b": [1, 1, 1]}, {"a": 2, "b": 1}),
392-
],
393-
)
394-
def test_unique_agg_type_is_series(test, constant):
395-
# GH#22558
396-
df1 = DataFrame(test)
397-
expected = Series(data=constant, index=["a", "b"], dtype="object")
398-
aggregation = {"a": "unique", "b": "unique"}
399-
400-
result = df1.agg(aggregation)
401-
402-
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)