view MoinMoin/i18n/_tests/test_i18n.py @ 1974:87272c032485

remove unused imports
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 10 Feb 2013 23:54:13 +0100
parents 4ac437141bbe
children 181a556a0920
line wrap: on
line source
# Copyright: 2011 Prashant Kumar <contactprashantat AT gmail DOT com>
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

"""
Test for i18n
"""

from MoinMoin.i18n import get_locale, get_timezone

from MoinMoin.i18n import _, L_, N_

def test_user_attributes():
    test_locale = get_locale()
    assert test_locale == 'en'

    test_timezone = get_timezone()
    assert test_timezone == 'UTC'

def test_text():
    # test for gettext
    result = _('test_text')
    assert result == 'test_text'

    # test for lazy_gettext
    result = L_('test_lazy_text')
    assert result == u'test_lazy_text'

    # test for ngettext
    result1 = N_('text1', 'text2', 1)
    assert result1 == 'text1'
    result2 = N_('text1', 'text2', 2)
    assert result2 == 'text2'