Skip to content

Commit 237bb31

Browse files
authored
TST: add test for describe include/exclude (#39101)
1 parent d5be455 commit 237bb31

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/frame/methods/test_describe.py

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import numpy as np
2+
import pytest
23

34
import pandas as pd
45
from pandas import Categorical, DataFrame, Series, Timestamp, date_range
@@ -360,3 +361,13 @@ def test_describe_percentiles_integer_idx(self):
360361
],
361362
)
362363
tm.assert_frame_equal(result, expected)
364+
365+
@pytest.mark.parametrize("exclude", ["x", "y", ["x", "y"], ["x", "z"]])
366+
def test_describe_when_include_all_exclude_not_allowed(self, exclude):
367+
"""
368+
When include is 'all', then setting exclude != None is not allowed.
369+
"""
370+
df = DataFrame({"x": [1], "y": [2], "z": [3]})
371+
msg = "exclude must be None when include is 'all'"
372+
with pytest.raises(ValueError, match=msg):
373+
df.describe(include="all", exclude=exclude)

0 commit comments

Comments
 (0)