def test_strcoll_u(): orig_locale = rsetlocale(LC_COLLATE, None) rsetlocale(LC_COLLATE, "fr_FR.ISO8859-1") e_acute = u'é'.encode('latin1') assert strcoll_u('f', 'e') > 0 assert strcoll_u('f', e_acute) > 0 rsetlocale(LC_COLLATE, orig_locale)
def has_locales(*locales): """Check if te locales are available on the system""" orig_locale = rsetlocale(LC_CTYPE, None) try: for locale in locales: rsetlocale(LC_CTYPE, locale) except LocaleError: return False else: return True finally: rsetlocale(LC_CTYPE, orig_locale)