diff options
author | wolfhong <hongxucai1991@163.com> | 2018-05-08 20:59:12 +0800 |
---|---|---|
committer | wolfhong <hongxucai1991@163.com> | 2018-05-08 20:59:12 +0800 |
commit | 34b0deead2bbff15c0da730e05564d055fe8590e (patch) | |
tree | 2305132076936187c4e1cb917027341a29c8ea72 | |
parent | ee0dbe6e4368ab0e93c6353963a242f4566ba416 (diff) | |
download | python-prettytable-ptable-34b0deead2bbff15c0da730e05564d055fe8590e.tar.gz |
add test for get_markdown and get_rst
-rw-r--r-- | tests/test_prettytable.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_prettytable.py b/tests/test_prettytable.py index 6d8c573..235cd81 100644 --- a/tests/test_prettytable.py +++ b/tests/test_prettytable.py @@ -727,5 +727,37 @@ g.. """.strip()) +class PrintMarkdownAndRstTest(unittest.TestCase): + def setUp(self): + self.x = PrettyTable(["A", "B", "C"]) + self.x.add_row(["a", "b", "c"]) + self.x.add_row(["aa", "bb", "cc"]) + + def testMarkdownOutput(self): + result = self.x.get_markdown() + print() + print(result) + self.assertEqual(result.strip(), """ +| A | B | C | +|----|----|----| +| a | b | c | +| aa | bb | cc | +""".strip()) + + def testRstOutput(self): + result = self.x.get_rst() + print() + print(result) + self.assertEqual(result.strip(), """ ++----+----+----+ +| A | B | C | ++====+====+====+ +| a | b | c | ++----+----+----+ +| aa | bb | cc | ++----+----+----+ +""".strip()) + + if __name__ == "__main__": unittest.main() |