diff options
| author | Mark Walling <mark@markwalling.org> | 2011-07-11 17:13:47 -0400 |
|---|---|---|
| committer | Mark Walling <mark@markwalling.org> | 2011-07-11 17:26:21 -0400 |
| commit | e74a8f41cc0bdfe1cb9aae90b9240fd15208e9cb (patch) | |
| tree | 01cc0408ffea156442f723de66ead76ba9dba5e5 /test_tablib.py | |
| parent | cd5aa4fc06d9af90b076c02a9f596bb84db1d09f (diff) | |
| download | tablib-e74a8f41cc0bdfe1cb9aae90b9240fd15208e9cb.tar.gz | |
Created get_col method with tests and tutorial.rst update
Useful when you have multiple columns with the same header
Diffstat (limited to 'test_tablib.py')
| -rwxr-xr-x | test_tablib.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test_tablib.py b/test_tablib.py index 5fdf65a..48990a7 100755 --- a/test_tablib.py +++ b/test_tablib.py @@ -113,6 +113,22 @@ class TablibTestCase(unittest.TestCase): [self.john[2], self.george[2], self.tom[2]]) + def test_get_col(self): + """Verify getting columns by index""" + + self.assertEqual( + self.founders.get_col(self.headers.index('first_name')), + [self.john[0], self.george[0], self.tom[0]]) + + self.assertEqual( + self.founders.get_col(self.headers.index('last_name')), + [self.john[1], self.george[1], self.tom[1]]) + + self.assertEqual( + self.founders.get_col(self.headers.index('gpa')), + [self.john[2], self.george[2], self.tom[2]]) + + def test_data_slicing(self): """Verify slicing by data.""" |
