(self, section, max_width, stream)
| 301 | stream.write('+%s+' % ('-' * (max_width - 2)) + '\n') |
| 302 | |
| 303 | def _render_column_titles(self, section, max_width, stream): |
| 304 | if not section.headers: |
| 305 | return |
| 306 | # In order to render the column titles we need to know |
| 307 | # the width of each of the columns. |
| 308 | widths = section.calculate_column_widths( |
| 309 | padding=4, max_width=max_width |
| 310 | ) |
| 311 | # TODO: Built a list instead of +=, it's more efficient. |
| 312 | current = '' |
| 313 | length_so_far = 0 |
| 314 | # The first cell needs both left and right edges '| foo |' |
| 315 | # while subsequent cells only need right edges ' foo |'. |
| 316 | first = True |
| 317 | for width, header in zip(widths, section.headers): |
| 318 | stylized_header = self._styler.style_header_column(header) |
| 319 | if first: |
| 320 | left_edge = '|' |
| 321 | first = False |
| 322 | else: |
| 323 | left_edge = '' |
| 324 | current += center_text( |
| 325 | text=stylized_header, |
| 326 | length=width, |
| 327 | left_edge=left_edge, |
| 328 | right_edge='|', |
| 329 | text_length=get_text_length(header), |
| 330 | ) |
| 331 | length_so_far += width |
| 332 | self._write_line_break(stream, widths) |
| 333 | stream.write(current + '\n') |
| 334 | |
| 335 | def _write_line_break(self, stream, widths): |
| 336 | # Write out something like: |
no test coverage detected