def get_count_sort_key(count_and_word): ''' The key for the sort data which is a list of tuples (count, word) The count is returned as a negative number so that the sorted data starts with the high counts and goes down to the low counts rather than starting at 1 and going upwards. ''' return -count_and_word[0], mw.get_list_sort_key(count_and_word[1])
def test_get_list_sort_key(): assert mw.get_list_sort_key('rā') == (['r', 'a'], ['r', 'ā'], ['r', 'ā']) assert mw.get_list_sort_key('NGĀ') == (['ng', 'a'], ['ng', 'ā'], ['NG', 'Ā'])