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')
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')
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')