def _CreateAvailabilityLine(header, items, header_indent=2, items_indent=25, line_length=80): items_width = line_length - items_indent items_text = '\n'.join(formatting.WrappedJoin(items, width=items_width)) indented_items_text = formatting.Indent(items_text, spaces=items_indent) indented_header = formatting.Indent(header, spaces=header_indent) return indented_header + indented_items_text[len(indented_header):] + '\n'
def _CreateItem(name, description, indent=2): if not description: return name return """{name} {description}""".format(name=name, description=formatting.Indent(description, indent))
def _CreateOutputSection(name, content): return """{name} {content}""".format(name=formatting.Bold(name), content=formatting.Indent(content, 4))
def test_indent_multiple_lines(self): text = formatting.Indent('hello\nworld', spaces=2) self.assertEqual(' hello\n world', text)
def test_indent(self): text = formatting.Indent('hello', spaces=2) self.assertEqual(' hello', text)