コード例 #1
0
def test_monetary():
    for loc in CANDIDATE_LOCALES:
        lc_norm = _normalize(loc)
        _set_locale(locale.LC_NUMERIC, lc_norm)
        setlocale(loc)
        # short
        nl = locale.localeconv()
        li = localeconv()
        for k, v in nl.items():
            assert v == li[k], '%s (%s): %s %r != %r' % (loc, lc_norm, k, v, li[k])
コード例 #2
0
def test_numeric():
    for loc in CANDIDATE_LOCALES:
        lc_norm = _normalize(loc)
        _set_locale(locale.LC_NUMERIC, lc_norm)
        setlocale(loc)
        # short
        for what in (locale.ALT_DIGITS, locale.RADIXCHAR, locale.THOUSEP):
            nl = nl_langinfo(what)
            lo = locale.nl_langinfo(what)
            assert nl == lo, '%s (%s): %r != %r' % (loc, lc_norm, nl, lo)
コード例 #3
0
def test_era():
    for loc in CANDIDATE_LOCALES:
        lc_norm = _normalize(loc)
        _set_locale(locale.LC_TIME, lc_norm)
        setlocale(loc)
        for what in (
                     locale.ERA, locale.ERA_D_T_FMT, locale.ERA_D_FMT,
                     ):
            nl = nl_langinfo(what)
            lo = locale.nl_langinfo(what)
            assert nl == lo, '%r != %r' % (nl, lo)
コード例 #4
0
def test_date_time_format():
    for loc in CANDIDATE_LOCALES:
        lc_norm = _normalize(loc)
        _set_locale(locale.LC_TIME, lc_norm)
        setlocale(loc)
        for what in (
                     locale.D_T_FMT, locale.D_FMT, locale.T_FMT, locale.T_FMT_AMPM,
                     ):
            nl = nl_langinfo(what)
            lo = locale.nl_langinfo(what)
            assert nl == lo, '%r != %r' % (nl, lo)
コード例 #5
0
def test_month_names():
    for loc in CANDIDATE_LOCALES:
        lc_norm = _normalize(loc)
        _set_locale(locale.LC_TIME, lc_norm)
        setlocale(loc)
        for what in (
                     locale.MON_1, locale.MON_2, locale.MON_3, locale.MON_4, locale.MON_5, locale.MON_6, locale.MON_7, locale.MON_8, locale.MON_9, locale.MON_10, locale.MON_11, locale.MON_12, 
                     locale.ABMON_1, locale.ABMON_2, locale.ABMON_3, locale.ABMON_4, locale.ABMON_5, locale.ABMON_6, locale.ABMON_7, locale.ABMON_8, locale.ABMON_9, locale.ABMON_10, locale.ABMON_11, locale.ABMON_12, 
                     ):
            nl = nl_langinfo(what)
            lo = locale.nl_langinfo(what)
            assert nl == lo, '%r != %r' % (nl, lo)
コード例 #6
0
def test_day_names():
    for loc in CANDIDATE_LOCALES:
        lc_norm = _normalize(loc)
        _set_locale(locale.LC_TIME, lc_norm)
        setlocale(loc)
        for what in (
                     locale.DAY_1, locale.DAY_2, locale.DAY_3, locale.DAY_4, locale.DAY_5, locale.DAY_6, locale.DAY_7,
                     locale.ABDAY_1, locale.ABDAY_2, locale.ABDAY_3, locale.ABDAY_4, locale.ABDAY_5, locale.ABDAY_6, locale.ABDAY_7, 
                     ):
            nl = nl_langinfo(what)
            lo = locale.nl_langinfo(what)
            assert nl == lo, '%r != %r' % (nl, lo)