Skip to content

Commit

Permalink
fix uppercase pre-translations
Browse files Browse the repository at this point in the history
  • Loading branch information
mib1185 committed Feb 8, 2024
1 parent 26b81c2 commit 83d358f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion slugify/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def add_uppercase_char(char_list: list[tuple[str, str]]) -> list[tuple[str, str]
upper_dict = char.upper(), xlate.capitalize()
if upper_dict not in char_list and char != upper_dict[0]:
char_list.insert(0, upper_dict)
return char_list
return char_list


Expand Down
3 changes: 3 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import unittest
from contextlib import contextmanager

from slugify import PRE_TRANSLATIONS
from slugify import slugify
from slugify import smart_truncate
from slugify.__main__ import slugify_params, parse_args
Expand Down Expand Up @@ -236,6 +237,8 @@ def test_replacements_german_umlaut_custom(self):
r = slugify(txt, replacements=[['Ü', 'UE'], ['ü', 'ue']])
self.assertEqual(r, "ueber-ueber-german-umlaut")

def test_pre_translation(self):
self.assertEqual(PRE_TRANSLATIONS, [('Ю', 'U'), ('Щ', 'Sch'), ('У', 'Y'), ('Х', 'H'), ('Я', 'Ya'), ('Ё', 'E'), ('ё', 'e'), ('я', 'ya'), ('х', 'h'), ('у', 'y'), ('щ', 'sch'), ('ю', 'u'), ('Ü', 'Ue'), ('Ö', 'Oe'), ('Ä', 'Ae'), ('ä', 'ae'), ('ö', 'oe'), ('ü', 'ue'), ('Ϋ́', 'Y'), ('Ϋ', 'Y'), ('Ύ', 'Y'), ('Υ', 'Y'), ('Χ', 'Ch'), ('χ', 'ch'), ('Ξ', 'X'), ('ϒ', 'Y'), ('υ', 'y'), ('ύ', 'y'), ('ϋ', 'y'), ('ΰ', 'y')])

class TestSlugifyUnicode(unittest.TestCase):

Expand Down

0 comments on commit 83d358f

Please sign in to comment.