diff options
| author | Kenneth Reitz <me@kennethreitz.com> | 2011-01-31 01:35:52 -0500 |
|---|---|---|
| committer | Kenneth Reitz <me@kennethreitz.com> | 2011-01-31 01:35:52 -0500 |
| commit | 26b6faa88d0c272f7f8153cbd2de6ce451e22caf (patch) | |
| tree | ef25c2f5969cfa88d4802243a588e753a2118834 /test_tablib.py | |
| parent | 7727171379683dcf859a344d6c8a43dc6d5cfa2b (diff) | |
| parent | 140736ff332ff164f18821ec150488b1a2092898 (diff) | |
| download | tablib-0.9.3.tar.gz | |
Merge branch 'release/0.9.3'v0.9.3
Diffstat (limited to 'test_tablib.py')
| -rwxr-xr-x | test_tablib.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test_tablib.py b/test_tablib.py index 8e2454f..15630f2 100755 --- a/test_tablib.py +++ b/test_tablib.py @@ -5,6 +5,8 @@ import unittest +from tablib.packages import markup + import tablib @@ -182,6 +184,27 @@ class TablibTestCase(unittest.TestCase): self.assertEqual(tsv, self.founders.tsv) + def test_html_export(self): + + """HTML export""" + + html = markup.page() + html.table.open() + html.thead.open() + + html.tr(markup.oneliner.th(self.founders.headers)) + html.thead.close() + + for founder in self.founders: + + html.tr(markup.oneliner.td(founder)) + + html.table.close() + html = str(html) + + self.assertEqual(html, self.founders.html) + + def test_unicode_append(self): """Passes in a single unicode charecter and exports.""" @@ -402,6 +425,22 @@ class TablibTestCase(unittest.TestCase): self.assertEqual(column_stacked[0], ("John", "Adams", 90, "John", "Adams", 90)) + def test_sorting(self): + + """Sort columns.""" + + sorted_data = self.founders.sort(col="first_name") + + first_row = sorted_data[0] + second_row = sorted_data[2] + third_row = sorted_data[1] + expected_first = self.founders[1] + expected_second = self.founders[2] + expected_third = self.founders[0] + + self.assertEqual(first_row, expected_first) + self.assertEqual(second_row, expected_second) + self.assertEqual(third_row, expected_third) def test_wipe(self): """Purge a dataset.""" |
