()
| 282 | |
| 283 | |
| 284 | def test_info_max_cols(): |
| 285 | df = DataFrame(np.random.default_rng(2).standard_normal((10, 5))) |
| 286 | for len_, verbose in [(5, None), (5, False), (12, True)]: |
| 287 | # For verbose always ^ setting ^ summarize ^ full output |
| 288 | with option_context("max_info_columns", 4): |
| 289 | buf = StringIO() |
| 290 | df.info(buf=buf, verbose=verbose) |
| 291 | res = buf.getvalue() |
| 292 | assert len(res.strip().split("\n")) == len_ |
| 293 | |
| 294 | for len_, verbose in [(12, None), (5, False), (12, True)]: |
| 295 | # max_cols not exceeded |
| 296 | with option_context("max_info_columns", 5): |
| 297 | buf = StringIO() |
| 298 | df.info(buf=buf, verbose=verbose) |
| 299 | res = buf.getvalue() |
| 300 | assert len(res.strip().split("\n")) == len_ |
| 301 | |
| 302 | for len_, max_cols in [(12, 5), (5, 4)]: |
| 303 | # setting truncates |
| 304 | with option_context("max_info_columns", 4): |
| 305 | buf = StringIO() |
| 306 | df.info(buf=buf, max_cols=max_cols) |
| 307 | res = buf.getvalue() |
| 308 | assert len(res.strip().split("\n")) == len_ |
| 309 | |
| 310 | # setting wouldn't truncate |
| 311 | with option_context("max_info_columns", 5): |
| 312 | buf = StringIO() |
| 313 | df.info(buf=buf, max_cols=max_cols) |
| 314 | res = buf.getvalue() |
| 315 | assert len(res.strip().split("\n")) == len_ |
| 316 | |
| 317 | |
| 318 | def test_info_memory_usage(): |
nothing calls this directly
no test coverage detected