/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 breezy/tests/test_errors.py

  • Committer: Jelmer Vernooij
  • Date: 2018-08-21 07:56:36 UTC
  • mfrom: (7078 work)
  • mto: This revision was merged to the branch mainline in revision 7093.
  • Revision ID: jelmer@jelmer.uk-20180821075636-ranyu9myp6er1d8z
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    urlutils,
30
30
    )
31
31
from ..sixish import (
 
32
    PY3,
32
33
    text_type,
33
34
    )
34
35
 
511
512
    def test_always_str(self):
512
513
        e = PassThroughError(u'\xb5', 'bar')
513
514
        self.assertIsInstance(e.__str__(), str)
514
 
        # In Python str(foo) *must* return a real byte string
 
515
        # In Python 2 str(foo) *must* return a real byte string
515
516
        # not a Unicode string. The following line would raise a
516
517
        # Unicode error, because it tries to call str() on the string
517
518
        # returned from e.__str__(), and it has non ascii characters
518
519
        s = str(e)
519
 
        self.assertEqual('Pass through \xc2\xb5 and bar', s)
 
520
        if PY3:
 
521
            self.assertEqual('Pass through \xb5 and bar', s)
 
522
        else:
 
523
            self.assertEqual('Pass through \xc2\xb5 and bar', s)
520
524
 
521
525
    def test_missing_format_string(self):
522
526
        e = ErrorWithNoFormat(param='randomvalue')