def test_table_default_sort(qtbot):
    table = Table()
    table.show()
    # qtbot.waitForWindowShown(table)

    with raises(ValueError):
        table.add_column(lambda _: _)

    def count(id):
        return 10 * id - 10000.5
    table.add_column(count)
    table.set_default_sort('count', 'asc')
    table.set_rows(range(10))

    assert table.default_sort == ('count', 'asc')
    table.next()
    assert table.selected == [9]

    table.sort_by('id', 'desc')
    table.set_rows(range(11))
    table.next()
    assert table.selected == [10]

    table.close()
dataset/ETHPy150Open kwikteam/phy/phy/gui/tests/test_widgets.py/test_table_default_sort/swapped operands of `-`