/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to brzlib/tests/test_i18n.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 12:41:27 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521124127-iv8etg0vwymyai6y
s/bzr/brz/ in apport config.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
"""Tests for breezy.i18n"""
18
 
 
19
 
import io
20
 
 
21
 
from .. import (
 
17
"""Tests for brzlib.i18n"""
 
18
 
 
19
from brzlib import (
22
20
    i18n,
23
21
    tests,
24
22
    errors,
37
35
    def zzz(self, s):
38
36
        return u'zz\xe5{{%s}}' % s
39
37
 
40
 
    def gettext(self, s):
41
 
        return self.zzz(self._null_translation.gettext(s))
42
 
 
43
 
    def ngettext(self, s, p, n):
44
 
        return self.zzz(self._null_translation.ngettext(s, p, n))
45
 
 
46
38
    def ugettext(self, s):
47
39
        return self.zzz(self._null_translation.ugettext(s))
48
40
 
62
54
        t = trans.zzz('msg')
63
55
        self._check_exact(u'zz\xe5{{msg}}', t)
64
56
 
65
 
        t = trans.gettext('msg')
 
57
        t = trans.ugettext('msg')
66
58
        self._check_exact(u'zz\xe5{{msg}}', t)
67
59
 
68
 
        t = trans.ngettext('msg1', 'msg2', 0)
 
60
        t = trans.ungettext('msg1', 'msg2', 0)
69
61
        self._check_exact(u'zz\xe5{{msg2}}', t)
70
 
        t = trans.ngettext('msg1', 'msg2', 2)
 
62
        t = trans.ungettext('msg1', 'msg2', 2)
71
63
        self._check_exact(u'zz\xe5{{msg2}}', t)
72
64
 
73
 
        t = trans.ngettext('msg1', 'msg2', 1)
 
65
        t = trans.ungettext('msg1', 'msg2', 1)
74
66
        self._check_exact(u'zz\xe5{{msg1}}', t)
75
67
 
76
68
 
149
141
        tree = self.make_branch_and_tree('.')
150
142
        try:
151
143
            workingtree.WorkingTree.open('./foo')
152
 
        except errors.NotBranchError as e:
 
144
        except errors.NotBranchError,e:
153
145
            err = str(e)
154
 
        self.assertContainsRe(err, u"zz\xe5{{Not a branch: .*}}")
 
146
        self.assertContainsRe(err, 
 
147
                              u"zz\xe5{{Not a branch: .*}}".encode("utf-8"))
155
148
 
156
149
    def test_topic_help_translation(self):
157
150
        """does topic help get translated?"""
158
 
        from .. import help
159
 
        out = io.StringIO()
 
151
        from brzlib import help
 
152
        from StringIO import StringIO
 
153
        out = StringIO()
160
154
        help.help("authentication", out)
161
 
        self.assertContainsRe(
162
 
            out.getvalue(), "zz\xe5{{Authentication Settings")
 
155
        self.assertContainsRe(out.getvalue(), "zz\xe5{{Authentication Settings")
163
156
 
164
157
 
165
158
class LoadPluginTranslations(tests.TestCase):