From fa30ea858d0ac41f2f542e0c50d9f9a2e343deb2 Mon Sep 17 00:00:00 2001 From: Daniel Santos Date: Tue, 10 Dec 2019 00:04:03 +0100 Subject: =?UTF-8?q?Implement=20feature=20that=20allows=20to=20export=20tab?= =?UTF-8?q?ular=20data=20suited=20to=20a=E2=80=A6=20(#437)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/requirements.txt | 1 + tests/test_tablib.py | 11 +++++++++++ 2 files changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/requirements.txt b/tests/requirements.txt index dc91fc9..8d49fd2 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -5,5 +5,6 @@ odfpy openpyxl>=2.4.0 pandas pyyaml +tabulate xlrd xlwt diff --git a/tests/test_tablib.py b/tests/test_tablib.py index 5754bb2..8918105 100755 --- a/tests/test_tablib.py +++ b/tests/test_tablib.py @@ -1288,3 +1288,14 @@ class DocTests(unittest.TestCase): import tablib.formats._rst results = doctest.testmod(tablib.formats._rst) self.assertEqual(results.failed, 0) + + +class CliTests(BaseTestCase): + def test_cli_export_github(self): + self.assertEqual('|---|---|---|\n| a | b | c |', tablib.Dataset(['a','b','c']).export('cli', tablefmt='github')) + + def test_cli_export_simple(self): + self.assertEqual('- - -\na b c\n- - -', tablib.Dataset(['a','b','c']).export('cli', tablefmt='simple')) + + def test_cli_export_grid(self): + self.assertEqual('+---+---+---+\n| a | b | c |\n+---+---+---+', tablib.Dataset(['a','b','c']).export('cli', tablefmt='grid')) -- cgit v1.2.1