def test_sort():
 model = _create_model([[('B', '', '', 1), ('C', '', '', 2), ('A', '', '', 0)]])
 filter_model = sortfilter.CompletionFilterModel(model)
 filter_model.sort(0, Qt.AscendingOrder)
 actual = _extract_model_data(filter_model)
 assert (actual == [[('A', '', ''), ('B', '', ''), ('C', '', '')]])
 filter_model.sort(0, Qt.DescendingOrder)
 actual = _extract_model_data(filter_model)
 assert (actual == [[('C', '', ''), ('B', '', ''), ('A', '', '')]])

def test_sort ( ) : model = _create_model ( [ [ ( 'B' , '' , '' , 1 ) , ( 'C' , '' , '' , 2 ) , ( 'A' , '' , '' , 0 ) ] ] ) filter_model = sortfilter . CompletionFilterModel ( model ) filter_model . sort ( 0 , Qt . AscendingOrder ) actual = _extract_model_data ( filter_model ) assert ( actual == [ [ ( 'A' , '' , '' ) , ( 'B' , '' , '' ) , ( 'C' , '' , '' ) ] ] ) filter_model . sort ( 0 , Qt . DescendingOrder ) actual = _extract_model_data ( filter_model ) assert ( actual == [ [ ( 'C' , '' , '' ) , ( 'B' , '' , '' ) , ( 'A' , '' , '' ) ] ] )
ensure that a sort argument passed to sort overrides dumb_sort .