diff options
author | Sebastian Olsson <sebelino7@gmail.com> | 2016-05-02 17:57:18 +0200 |
---|---|---|
committer | kxxoling <kxxoling@gmail.com> | 2016-07-13 13:42:11 +0800 |
commit | cf69c5e9547f28a69b16e825cd8c4d22ec39259a (patch) | |
tree | 9f8ea99c5f56b5dd4efc5f9d155abc56fc98dfd5 | |
parent | 137af861792f8a4dc686ad8e6b753352f028f3d2 (diff) | |
download | python-prettytable-ptable-cf69c5e9547f28a69b16e825cd8c4d22ec39259a.tar.gz |
Added test cases for unpadded tables.
-rw-r--r-- | tests/test_prettytable.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_prettytable.py b/tests/test_prettytable.py index 09ea4b7..f28cfcd 100644 --- a/tests/test_prettytable.py +++ b/tests/test_prettytable.py @@ -687,5 +687,33 @@ class PrintJapaneseTest(unittest.TestCase): 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() |