from nest_ui import TableModel

def test_table_sort_filter_edit():
    table = TableModel(["Name", "Type"], [["B", "web"], ["A", "bot"]])
    table.sort_by("Name")
    assert table.filtered_rows[0][0] == "A"
    table.filter("web")
    assert len(table.filtered_rows) == 1
    table.edit_cell(0, "Name", "Z")
    assert table.rows[0][0] == "Z"
