Exemplo n.º 1
0
 def test_write_with_skip_and_limit(self):
     table = Table([
         ["Alice", 33],
         ["Bob", 44],
         ["Carol", 55],
         ["Dave", 66],
     ], keys=["name", "age"])
     out = StringIO()
     table.write(out, skip=1, limit=2)
     self.assertEqual(out.getvalue(), u' Bob   | 44 \r\n'
                                      u' Carol | 55 \r\n')
Exemplo n.º 2
0
 def test_write(self):
     table = Table([
         ["Alice", 33],
         ["Bob", 44],
         ["Carol", 55],
         ["Dave", 66],
     ], keys=["name", "age"])
     out = StringIO()
     table.write(out)
     self.assertEqual(out.getvalue(), u' Alice | 33 \r\n'
                                      u' Bob   | 44 \r\n'
                                      u' Carol | 55 \r\n'
                                      u' Dave  | 66 \r\n')
Exemplo n.º 3
0
 def test_write_with_style(self):
     table = Table([
         ["Alice", 33],
         ["Bob", 44],
         ["Carol", 55],
         ["Dave", 66],
     ], keys=["name", "age"])
     out = StringIO()
     table.write(out, header={"fg": "red"})
     self.assertEqual(out.getvalue(), u' name  | age \r\n'
                                      u'-------|-----\r\n'
                                      u' Alice |  33 \r\n'
                                      u' Bob   |  44 \r\n'
                                      u' Carol |  55 \r\n'
                                      u' Dave  |  66 \r\n')