~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_i18n.py

  • Committer: Vincent Ladeuil
  • Date: 2011-05-31 10:01:15 UTC
  • mto: (5993.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5994.
  • Revision ID: v.ladeuil+lp@free.fr-20110531100115-bkea029bq5oki70l
Put the '\n' back into the formats and fix tests accordingly (reducing code duplication).

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from bzrlib import i18n, tests
20
20
 
21
21
 
 
22
 
 
23
 
22
24
class ZzzTranslations(object):
23
25
    """Special Zzz translation for debugging i18n stuff.
24
26
 
65
67
 
66
68
    def setUp(self):
67
69
        super(TestGetText, self).setUp()
68
 
        self.overrideAttr(i18n, '_translations', ZzzTranslations())
 
70
        self.overrideAttr(i18n, '_translation', ZzzTranslations())
69
71
 
70
72
    def test_oneline(self):
71
73
        self.assertEqual(u"zz{{spam ham eggs}}",
80
82
 
81
83
    def setUp(self):
82
84
        super(TestGetTextPerParagraph, self).setUp()
83
 
        self.overrideAttr(i18n, '_translations', ZzzTranslations())
 
85
        self.overrideAttr(i18n, '_translation', ZzzTranslations())
84
86
 
85
87
    def test_oneline(self):
86
88
        self.assertEqual(u"zz{{spam ham eggs}}",
89
91
    def test_multiline(self):
90
92
        self.assertEqual(u"zz{{spam\nham}}\n\nzz{{eggs\n}}",
91
93
                         i18n.gettext_per_paragraph("spam\nham\n\neggs\n"))
92
 
 
93
 
 
94
 
class TestInstall(tests.TestCase):
95
 
 
96
 
    def test_custom_languages(self):
97
 
        self.addCleanup(i18n.install)
98
 
        i18n.install('nl:fy')
99
 
 
100
 
    def test_no_env_variables(self):
101
 
        self.addCleanup(i18n.install)
102
 
        self.overrideEnv('LANGUAGE', None)
103
 
        self.overrideEnv('LC_ALL', None)
104
 
        self.overrideEnv('LC_MESSAGES', None)
105
 
        self.overrideEnv('LANG', None)
106
 
        i18n.install()