/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-08-21 09:32:52 UTC
  • mfrom: (7065.3.15 python-bundle)
  • Revision ID: breezy.the.bot@gmail.com-20180821093252-dhir83sygqwzbv77
Fix some bundle-related tests on Python 3.

Merged from https://code.launchpad.net/~jelmer/brz/python-bundle/+merge/353123

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')