Skip to content

Commit

Permalink
Added test cases for unpadded tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebelino authored and kxxoling committed Jul 13, 2016
1 parent 137af86 commit cf69c5e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/test_prettytable.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,5 +687,33 @@ def testPrint(self):
print(self.x)


class UnpaddedTableTest(unittest.TestCase):
def setUp(self):
self.x = PrettyTable(header=False, padding_width=0)
self.x.add_row("abc")
self.x.add_row("def")
self.x.add_row("g..")

def testUnbordered(self):
self.x.border = False
result = self.x.get_string()
assert result.strip() == """
abc
def
g..
""".strip()

def testBordered(self):
self.x.border = True
result = self.x.get_string()
assert result.strip() == """
+-+-+-+
|a|b|c|
|d|e|f|
|g|.|.|
+-+-+-+
""".strip()


if __name__ == "__main__":
unittest.main()

0 comments on commit cf69c5e

Please sign in to comment.