Support for Dataset transposition. Unit-tested.

This commit is contained in:
Luca Beltrame
2010-11-11 09:00:06 +01:00
parent 2bb0525990
commit 657ab98d04
2 changed files with 42 additions and 1 deletions
+13
View File
@@ -349,6 +349,19 @@ class TablibTestCase(unittest.TestCase):
self.assertEqual(tablib.detect(_json)[0], tablib.formats.json)
self.assertEqual(tablib.detect(_bunk)[0], None)
def test_transpose(self):
"""Transpose a dataset."""
transposed_founders = self.founders.transpose()
first_row = transposed_founders[0]
second_row = transposed_founders[1]
self.assertEqual(transposed_founders.headers,
["first_name","John", "George", "Thomas"])
self.assertEqual(first_row,
("last_name","Adams", "Washington", "Jefferson"))
self.assertEqual(second_row,
("gpa",90, 67, 50))
def test_wipe(self):
"""Purge a dataset."""