forked from openlp/openlp
natural sort lower case
This commit is contained in:
parent
3eecea213d
commit
41d627e3f9
@ -699,7 +699,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
Return a tuple by which s is sorted.
|
Return a tuple by which s is sorted.
|
||||||
:param s: A string value from the list we want to sort.
|
:param s: A string value from the list we want to sort.
|
||||||
"""
|
"""
|
||||||
return [int(text) if text.isdecimal() else text
|
return [int(text) if text.isdecimal() else text.lower()
|
||||||
for text in re.split('(\d+)', s)]
|
for text in re.split('(\d+)', s)]
|
||||||
|
|
||||||
def search(self, string, show_error):
|
def search(self, string, show_error):
|
||||||
|
@ -427,7 +427,7 @@ class TestMediaItem(TestCase, TestMixin):
|
|||||||
sort_key_result = self.media_item._natural_sort_key(string_sort_key)
|
sort_key_result = self.media_item._natural_sort_key(string_sort_key)
|
||||||
|
|
||||||
# THEN: We should get back a tuple split on integers
|
# THEN: We should get back a tuple split on integers
|
||||||
self.assertEqual(sort_key_result, ['A', 1, 'B', 12, 'C'])
|
self.assertEqual(sort_key_result, ['a', 1, 'b', 12, 'c'])
|
||||||
|
|
||||||
def build_remote_search_test(self):
|
def build_remote_search_test(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user