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

Function test_info_series

pandas/tests/series/methods/test_info.py:48–79  ·  view source on GitHub ↗
(
    lexsorted_two_level_string_multiindex, verbose, using_infer_string
)

Source from the content-addressed store, hash-verified

46
47@pytest.mark.parametrize("verbose", [True, False])
48def test_info_series(
49 lexsorted_two_level_string_multiindex, verbose, using_infer_string
50):
51 index = lexsorted_two_level_string_multiindex
52 ser = Series(range(len(index)), index=index, name="sth")
53 buf = StringIO()
54 ser.info(verbose=verbose, buf=buf)
55 result = buf.getvalue()
56
57 expected = textwrap.dedent(
58 """\
59 <class 'pandas.Series'>
60 MultiIndex: 10 entries, ('foo', 'one') to ('qux', 'three')
61 """
62 )
63 if verbose:
64 expected += textwrap.dedent(
65 """\
66 Series name: sth
67 Non-Null Count Dtype
68 -------------- -----
69 10 non-null int64
70 """
71 )
72 qualifier = "" if using_infer_string and HAS_PYARROW else "+"
73 expected += textwrap.dedent(
74 f"""\
75 dtypes: int64(1)
76 memory usage: {ser.memory_usage()}.0{qualifier} bytes
77 """
78 )
79 assert result == expected
80
81
82def test_info_memory():

Callers

nothing calls this directly

Calls 3

infoMethod · 0.95
memory_usageMethod · 0.95
SeriesClass · 0.90

Tested by

no test coverage detected