Пример #1
0
    def test_two_row_table(self):
        results = table.parseString(
            "\\par\\tabcol1\\tabcol2\n\\parrow1\\tabval1\\tabval2\n\\parrow2\\tabval12\\tabval22\n")
        self.assertEqual(1, len(results))
        ptable = results[0]
        rows = ptable.rows
        self.assertEqual(2, len(rows))

        row = rows[1]
        self.assertEqual(3, len(row))
        self.assertEqual('row2', row[0])
        self.assertEqual('val12', row[1])
        self.assertEqual('val22', row[2])
Пример #2
0
    def test_simple_table(self):
        results = table.parseString(
            "\\par\\tabcol1\\tabcol2\n\\parrow1\\tabval1\\tabval2\n")
        self.assertEqual(1, len(results))
        ptable = results[0]
        cols = ptable.column_headings
        self.assertEqual(3, len(cols))
        self.assertEqual('', cols[0])
        self.assertEqual('col1', cols[1])
        self.assertEqual('col2', cols[2])

        rows = ptable.rows
        self.assertEqual(1, len(rows))

        row1 = rows[0]
        self.assertEqual(3, len(row1))
        self.assertEqual('row1', row1[0])
        self.assertEqual('val1', row1[1])
        self.assertEqual('val2', row1[2])