def test_sort_order(self): sorter = notes_db.AlphaNumSorter() notes = [ create_note('abcd'), create_note('abcd-'), create_note('abcd-200'), create_note('abcd-2#a'), create_note('bcd-200'), create_note('10-xyz'), create_note('10-abc'), create_note('1.2-xxx'), create_note('1.10-yyy'), create_note('7|foo'), ] self.assertSequenceEqual( sorted(notes, key=sorter), [ create_note('abcd'), create_note('abcd-'), create_note('abcd-2#a'), create_note('abcd-200'), create_note('bcd-200'), create_note('1.2-xxx'), create_note('1.10-yyy'), create_note('7|foo'), create_note('10-abc'), create_note('10-xyz'), ], )
def test_alphanum_10k_10times(self): for i in range(10): sorted(notes_10k, key=notes_db.AlphaNumSorter())
def make_sort_key(self, title): return notes_db.AlphaNumSorter()(create_note(title))