Exemplo n.º 1
0
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'
Exemplo n.º 2
0
 def test_wrap_multiple_items(self):
   lines = formatting.WrappedJoin(['rice', 'beans', 'chicken', 'cheese'],
                                  width=15)
   self.assertEqual(['rice | beans |',
                     'chicken |',
                     'cheese'], lines)
Exemplo n.º 3
0
 def test_wrap_one_item(self):
   lines = formatting.WrappedJoin(['rice'])
   self.assertEqual(['rice'], lines)
Exemplo n.º 4
0
 def test_wrap_multiple_items(self):
     lines = formatting.WrappedJoin(["rice", "beans", "chicken", "cheese"],
                                    width=15)
     self.assertEqual(["rice | beans |", "chicken |", "cheese"], lines)