Debian Codegraph @

lib/tests/test_i18n.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) 2008 Alexander Belchenko
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 """Tests for i18n module"""
20
21 from breezy.tests import TestCase
22 from breezy.plugins.qbrz.lib import i18n
23
24
25 class TestI18n(TestCase):
26
27 def setUp(self):
28 TestCase.setUp(self)
29 i18n.uninstall()
30
31 def tearDown(self):
32 i18n.uninstall()
33 TestCase.tearDown(self)
34
35 def test_gettext(self):
36 # simple pass-through
37 i18n.install()
38 self.assertEqual('file', i18n.gettext('file'))
39
40 def test_ngettext(self):
41 i18n.install()
42 self.assertEqual('singular', i18n.ngettext('singular', 'plural', 1))
43 self.assertEqual('plural', i18n.ngettext('singular', 'plural', 2))
44 self.assertEqual('plural', i18n.ngettext('singular', 'plural', 0))