MCPcopy
hub / github.com/pandas-dev/pandas / test_info_memory

Function test_info_memory

pandas/tests/frame/methods/test_info.py:206–225  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

204
205
206def test_info_memory():
207 # https://github.com/pandas-dev/pandas/issues/21056
208 df = DataFrame({"a": Series([1, 2], dtype="i8")})
209 buf = StringIO()
210 df.info(buf=buf)
211 result = buf.getvalue()
212 bytes = float(df.memory_usage().sum())
213 expected = textwrap.dedent(
214 f"""\
215 <class 'pandas.DataFrame'>
216 RangeIndex: 2 entries, 0 to 1
217 Data columns (total 1 columns):
218 # Column Non-Null Count Dtype
219 --- ------ -------------- -----
220 0 a 2 non-null int64
221 dtypes: int64(1)
222 memory usage: {bytes} bytes
223 """
224 )
225 assert result == expected
226
227
228def test_info_wide():

Callers

nothing calls this directly

Calls 5

infoMethod · 0.95
memory_usageMethod · 0.95
DataFrameClass · 0.90
SeriesClass · 0.90
sumMethod · 0.45

Tested by

no test coverage detected