Skip to content

Commit 316dd9b

Browse files
committed
TST: Using universal format for test_info_show_counts_false()
1 parent a4439be commit 316dd9b

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

pandas/tests/series/methods/test_info.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,20 @@ def test_info_memory_usage_bug_on_multiindex():
193193

194194

195195
def test_info_show_counts_false():
196-
# GH#62590
197-
s = Series([1, 2, None])
196+
s = Series([1])
198197
buf = StringIO()
199198
s.info(buf=buf, show_counts=False)
200199
result = buf.getvalue()
201-
assert "Non-Null Count" not in result
202-
assert "<class 'pandas.Series'>" in result
203-
assert "Dtype" in result
200+
memory_bytes = float(s.memory_usage())
201+
expected = textwrap.dedent(
202+
f"""\
203+
<class 'pandas.Series'>
204+
RangeIndex: 1 entries, 0 to 0
205+
Series name: None
206+
Dtype
207+
-----
208+
int64
209+
dtypes: int64(1)
210+
memory usage: {memory_bytes} bytes"""
211+
)
212+
assert result.strip() == expected.strip()

0 commit comments

Comments
 (0)