~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils_encodings.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2011 Canonical Ltd
 
1
# Copyright (C) 2006-2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
144
144
        self.assertEqual('latin-1', osutils.get_terminal_encoding())
145
145
 
146
146
        # check stderr
147
 
        self.assertEquals('', sys.stderr.getvalue())
 
147
        self.assertEqual('', sys.stderr.getvalue())
148
148
 
149
149
    def test_terminal_cp_unknown(self):
150
150
        # test against really unknown encoding
158
158
        self.assertEqual('latin-1', osutils.get_terminal_encoding())
159
159
 
160
160
        # check stderr
161
 
        self.assertEquals('bzr: warning: unknown terminal encoding cp-unknown.\n'
 
161
        self.assertEqual('bzr: warning: unknown terminal encoding cp-unknown.\n'
162
162
                          '  Using encoding latin-1 instead.\n',
163
163
                          sys.stderr.getvalue())
164
164
 
179
179
    def test_get_user_encoding(self):
180
180
        self._encoding = 'user_encoding'
181
181
        fake_codec.add('user_encoding')
182
 
        self.assertEquals('iso8859-1', # fake_codec maps to latin-1
 
182
        self.assertEqual('iso8859-1', # fake_codec maps to latin-1
183
183
                          osutils.get_user_encoding())
184
 
        self.assertEquals('', sys.stderr.getvalue())
 
184
        self.assertEqual('', sys.stderr.getvalue())
185
185
 
186
186
    def test_user_cp0(self):
187
187
        self._encoding = 'cp0'
188
 
        self.assertEquals('ascii', osutils.get_user_encoding())
189
 
        self.assertEquals('', sys.stderr.getvalue())
 
188
        self.assertEqual('ascii', osutils.get_user_encoding())
 
189
        self.assertEqual('', sys.stderr.getvalue())
190
190
 
191
191
    def test_user_cp_unknown(self):
192
192
        self._encoding = 'cp-unknown'
193
 
        self.assertEquals('ascii', osutils.get_user_encoding())
194
 
        self.assertEquals('bzr: warning: unknown encoding cp-unknown.'
 
193
        self.assertEqual('ascii', osutils.get_user_encoding())
 
194
        self.assertEqual('bzr: warning: unknown encoding cp-unknown.'
195
195
                          ' Continuing with ascii encoding.\n',
196
196
                          sys.stderr.getvalue())
197
197
 
198
198
    def test_user_empty(self):
199
199
        """Running bzr from a vim script gives '' for a preferred locale"""
200
200
        self._encoding = ''
201
 
        self.assertEquals('ascii', osutils.get_user_encoding())
202
 
        self.assertEquals('', sys.stderr.getvalue())
 
201
        self.assertEqual('ascii', osutils.get_user_encoding())
 
202
        self.assertEqual('', sys.stderr.getvalue())