Skip to content

Commit c81561c

Browse files
committed
Update test naming and remove assertion on repr
1 parent f232ad9 commit c81561c

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

pandas/tests/frame/methods/test_describe.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,15 @@ def test_describe_percentiles_integer_idx(self):
367367
)
368368
tm.assert_frame_equal(result, expected)
369369

370+
def test_describe_does_not_raise_error_for_dictlike_elements(self):
371+
# GH#32409
372+
df = DataFrame([{"test": {"a": "1"}}, {"test": {"a": "2"}}])
373+
expected = DataFrame(
374+
{"test": [2, 2, {"a": "1"}, 1]}, index=["count", "unique", "top", "freq"]
375+
)
376+
result = df.describe()
377+
tm.assert_frame_equal(result, expected)
378+
370379
@pytest.mark.parametrize("exclude", ["x", "y", ["x", "y"], ["x", "z"]])
371380
def test_describe_when_include_all_exclude_not_allowed(self, exclude):
372381
"""
@@ -376,20 +385,3 @@ def test_describe_when_include_all_exclude_not_allowed(self, exclude):
376385
msg = "exclude must be None when include is 'all'"
377386
with pytest.raises(ValueError, match=msg):
378387
df.describe(include="all", exclude=exclude)
379-
380-
def test_describe_does_not_raise_error(self):
381-
# GH#32409
382-
df = DataFrame([{"test": {"a": "1"}}, {"test": {"a": "2"}}])
383-
expected = DataFrame(
384-
{"test": [2, 2, {"a": "1"}, 1]}, index=["count", "unique", "top", "freq"]
385-
)
386-
result = df.describe()
387-
tm.assert_frame_equal(result, expected)
388-
exp_repr = (
389-
" test\n"
390-
"count 2\n"
391-
"unique 2\n"
392-
"top {'a': '1'}\n"
393-
"freq 1"
394-
)
395-
assert repr(result) == exp_repr

0 commit comments

Comments
 (0)