Ensure box drawing characters correctly positioned.
(show_header, show_footer, expected)
| 305 | ], |
| 306 | ) |
| 307 | def test_placement_table_box_elements(show_header, show_footer, expected): |
| 308 | """Ensure box drawing characters correctly positioned.""" |
| 309 | |
| 310 | table = Table( |
| 311 | box=box.ASCII, show_header=show_header, show_footer=show_footer, padding=0 |
| 312 | ) |
| 313 | |
| 314 | # content rows indicated by numerals, pure dividers by letters |
| 315 | table.box.__dict__.update( |
| 316 | top_left="a", |
| 317 | top="b", |
| 318 | top_divider="c", |
| 319 | top_right="d", |
| 320 | head_left="1", |
| 321 | head_vertical="2", |
| 322 | head_right="3", |
| 323 | head_row_left="e", |
| 324 | head_row_horizontal="f", |
| 325 | head_row_cross="g", |
| 326 | head_row_right="h", |
| 327 | mid_left="4", |
| 328 | mid_vertical="5", |
| 329 | mid_right="6", |
| 330 | row_left="i", |
| 331 | row_horizontal="j", |
| 332 | row_cross="k", |
| 333 | row_right="l", |
| 334 | foot_left="7", |
| 335 | foot_vertical="8", |
| 336 | foot_right="9", |
| 337 | foot_row_left="m", |
| 338 | foot_row_horizontal="n", |
| 339 | foot_row_cross="o", |
| 340 | foot_row_right="p", |
| 341 | bottom_left="q", |
| 342 | bottom="r", |
| 343 | bottom_divider="s", |
| 344 | bottom_right="t", |
| 345 | ) |
| 346 | |
| 347 | # add content - note headers title case, footers upper case |
| 348 | table.add_column("Month", "MONTH", width=5) |
| 349 | table.add_column("Nickname", "NICKNAME", width=9) |
| 350 | table.add_column("Cost", "COST", width=4) |
| 351 | table.add_column("Gross", "GROSS", width=5) |
| 352 | |
| 353 | table.add_row("Dec", "Skywalker", "275M", "375M") |
| 354 | table.add_row("May", "Solo", "275M", "393M") |
| 355 | table.add_section() |
| 356 | table.add_row("Dec", "Last Jedi", "262M", "1333M") |
| 357 | |
| 358 | console = Console(record=True, width=28) |
| 359 | console.print(table) |
| 360 | output = console.export_text() |
| 361 | print(repr(output)) |
| 362 | |
| 363 | assert output == expected |
| 364 |
nothing calls this directly
no test coverage detected