def test_map_row(self): table = TempyTable(data=self.data) table.map_row(lambda x: x - 1) self.assertEqual(-1, table.childs[0].childs[0].childs[0].childs[0]) # applies function x - 2 for first row table.map_row(lambda x: x - 2, 0) self.assertEqual(-3, table.childs[0].childs[0].childs[1].childs[0])
table1.map_col(lambda x: x.upper()) # set class for first column of each row table2.col_class('class_example_1', 0) # applies function to lower string for second column table2.map_col(lambda x: x.lower(), 1) # applies function to upper string for last column table2.map_col(lambda x: x.upper(), 4) # set class for every row table3.row_class('class_example_3') # applies function to upper string for every row table3.map_row(lambda x: x.upper()) # set class for second row table4.row_class('class_example_3', 1) # applies function to lower string for second row table4.map_row(lambda x: x.lower(), 1) # applies col scope to first cell table1.make_scope(col_scope_list=[(0, 0)]) # applies col scope to last two cells in last row table4.make_scope(row_scope_list=[(2, 3), (2, 4)]) page = Html()( Head()(