Beispiel #1
0
    def test_remove_empty_final_cols(self):
        ws = Worksheet()
        ws.append(Row(['a', None, None]))
        ws.append(Row(['b', None, 'd', None, '']))

        self.assertEqual(len(ws), 2)

        ws.remove_empty_final_cols()

        self.assertEqual(len(ws), 2)
        self.assertEqual(ws[0], Row(['a', None, None]))
        self.assertEqual(ws[1], Row(['b', None, 'd']))
Beispiel #2
0
    def test_remove_empty_final_rows(self):
        ws = Worksheet()
        ws.append(Row(['a', 'b']))
        ws.append(Row([None, None]))
        ws.append(Row(['c', 'd']))
        ws.append(Row([None, None]))
        ws.append(Row([None, None]))

        self.assertEqual(len(ws), 5)

        ws.remove_empty_final_rows()

        self.assertEqual(len(ws), 3)
        self.assertEqual(list(ws[0]), ['a', 'b'])
        self.assertEqual(list(ws[1]), [None, None])
        self.assertEqual(list(ws[2]), ['c', 'd'])