Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
o = self.unidecode(s)
self.assertEqual('THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 1234567890', o)
def test_enclosed_alphanumerics(self):
self.assertEqual(
'aA20(20)20.20100',
self.unidecode(_u('ⓐⒶ⑳⒇⒛⓴⓾⓿')),
)
class TestUnidecode(BaseTestUnidecode, unittest.TestCase):
unidecode = staticmethod(unidecode)
class TestUnidecodeExpectASCII(BaseTestUnidecode, unittest.TestCase):
unidecode = staticmethod(unidecode_expect_ascii)
class TestUnidecodeExpectNonASCII(BaseTestUnidecode, unittest.TestCase):
unidecode = staticmethod(unidecode_expect_nonascii)
if __name__ == "__main__":
unittest.main()
def sanitize_for_path(s):
""" Sanitize a string to be FAT/NTFS friendly when used in file path. """
s = s.translate(str.maketrans("/\\|*", "---x"))
s = "".join(c for c in unidecode.unidecode_expect_ascii(s) if c in VALID_PATH_CHARS)
s = s.strip()
s = s.rstrip(".") # this if for FAT on Android
return s