Skip to content

Commit

Permalink
Check that all characters transliterate to ASCII.
Browse files Browse the repository at this point in the history
  • Loading branch information
avian2 committed Feb 20, 2024
1 parent a4a5c9f commit 73d9eca
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/test_unidecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def clear(self):

class BaseTestUnidecode():

def test_ascii(self):
def test_ascii_to_self(self):

wlog = WarningLogger()
wlog.start("not an unicode object")
Expand All @@ -48,15 +48,19 @@ def test_ascii(self):

wlog.stop()

def test_bmp(self):
for n in range(0,0x10000):
def test_all_to_ascii(self):
for n in range(0,0x1ffff):
# skip over surrogate pairs, which throw a warning
if 0xd800 <= n <= 0xdfff:
continue

# Just check that it doesn't throw an exception
# Check that it doesn't throw an exception
t = chr(n)
self.unidecode(t)

u = self.unidecode(t)

# Check that returned string encodes to ASCII
b = u.encode('ascii')

def test_surrogates(self):
wlog = WarningLogger()
Expand Down

0 comments on commit 73d9eca

Please sign in to comment.