fixing test and other checks

This commit is contained in:
Zach Flanders 2023-04-25 21:00:16 -05:00
parent 575e1bac4c
commit f43d7f8c70
2 changed files with 5 additions and 2 deletions

View file

@ -369,7 +369,10 @@ class Edition(Book):
if self.sort_title in [None, ""]:
if self.sort_title in [None, ""]:
articles = chain(
*(LANGUAGE_ARTICLES.get(language, ()) for language in self.languages)
*(
LANGUAGE_ARTICLES.get(language, ())
for language in tuple(self.languages)
)
)
self.sort_title = re.sub(
f'^{" |^".join(articles)} ', "", str(self.title).lower()

View file

@ -142,4 +142,4 @@ class Book(TestCase):
for langauge, articles in settings.LANGUAGE_ARTICLES.items()
for article in articles
)
self.assertTrue(all(book.sort_title == "Test Edition" for book in books))
self.assertTrue(all(book.sort_title == "test edition" for book in books))