def test_set_row_fails_if_too_missing_cells(): table = Table() table.add_row(["a", "b", "c"]) table.add_row(["a", "b", "c"]) with pytest.raises(ValueError): table.set_row(1, ["a", "b"])
def test_set_rows(io): table = Table() table.set_rows([["a", "b", "c"], ["d", "e", "f"]]) table.render(io) table.set_row(1, ["g", "h", "i"]) table.render(io) expected = """\ +---+---+---+ | a | b | c | | d | e | f | +---+---+---+ +---+---+---+ | a | b | c | | g | h | i | +---+---+---+ """ assert expected == io.fetch_output()