def test_Table(self): headers = ['Product', 'Description'] rows = [{'cells': ['Gauge', 'Test automation with ease']}, {'cells': ['Mingle', 'Agile project management']}, {'cells': ['Snap', 'Hosted continuous integration']}, {'cells': ['Gocd', 'Continuous delivery platform']}] proto_table = ProtoTable({'headers': {'cells': headers}, 'rows': rows}) table = Table(proto_table) expected_rows = [row['cells'] for row in rows] expected_column_1 = [row['cells'][0] for row in rows] expected_column_2 = [row['cells'][1] for row in rows] self.assertEqual(headers, table.headers) self.assertEqual(expected_rows, table.rows) self.assertEqual(expected_column_1, table.get_column_values_with_index(1)) self.assertEqual(expected_column_2, table.get_column_values_with_index(2)) self.assertEqual(expected_column_1, table.get_column_values_with_name(headers[0])) self.assertEqual(expected_column_2, table.get_column_values_with_name(headers[1])) for row in expected_rows: self.assertEqual(row, table.get_row(expected_rows.index(row) + 1)) with self.assertRaises(IndexError): table.get_row(5)