

def test_set_locale(self):
    if (len(self.locales) == 1):
        raise nose.SkipTest('Only a single locale found, no point in trying to test setting another locale')
    if (LOCALE_OVERRIDE is not None):
        (lang, enc) = LOCALE_OVERRIDE.split('.')
    else:
        (lang, enc) = ('it_CH', 'UTF-8')
    enc = codecs.lookup(enc).name
    new_locale = (lang, enc)
    if (not tm._can_set_locale(new_locale)):
        with tm.assertRaises(locale.Error):
            with tm.set_locale(new_locale):
                pass
    else:
        with tm.set_locale(new_locale) as normalized_locale:
            (new_lang, new_enc) = normalized_locale.split('.')
            new_enc = codecs.lookup(new_locale).name
            normalized_locale = (new_lang, new_enc)
            self.assertEqual(normalized_locale, new_locale)
    current_locale = locale.getlocale()
    self.assertEqual(current_locale, CURRENT_LOCALE)

dataset/ETHPy150Open pydata/pandas/pandas/tools/tests/test_util.py TestLocaleUtils.test_set_locale/VarMisuse@168/251 `enc`->`new_locale`