summaryrefslogtreecommitdiff
path: root/tests/test_prettytable.py
diff options
context:
space:
mode:
authorKane Blueriver <kxxoling@gmail.com>2018-07-30 22:58:53 +0800
committerGitHub <noreply@github.com>2018-07-30 22:58:53 +0800
commitbcfdb92811ae1f39e1065f31544710bf87d3bc21 (patch)
tree4ea8e8f88f60ea23a9549bba1c0ea09343f0c8ce /tests/test_prettytable.py
parent46898fa095a2e24cd0551fe2ff6a3b80d5db3063 (diff)
parent1c78b292c8581d1d4ebf8d2b59f114dbde77c705 (diff)
downloadpython-prettytable-ptable-master.tar.gz
Merge pull request #25 from wolfhong/masterHEADmasterdevelop
Support markdown output string and reStructuredText output string
Diffstat (limited to 'tests/test_prettytable.py')
-rw-r--r--tests/test_prettytable.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_prettytable.py b/tests/test_prettytable.py
index 6d8c573..064e2b0 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_md_string()
+ 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_string()
+ print()
+ print(result)
+ self.assertEqual(result.strip(), """
++----+----+----+
+| A | B | C |
++====+====+====+
+| a | b | c |
++----+----+----+
+| aa | bb | cc |
++----+----+----+
+""".strip())
+
+
if __name__ == "__main__":
unittest.main()