/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-11-06 01:18:08 UTC
  • mfrom: (7143 work)
  • mto: This revision was merged to the branch mainline in revision 7151.
  • Revision ID: jelmer@jelmer.uk-20181106011808-y870f4vq0ork3ahu
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
 
48
49
            init = getattr(c, '__init__', None)
49
50
            fmt = getattr(c, '_fmt', None)
50
51
            if init:
51
 
                args = inspect.getargspec(init)[0]
 
52
                if PY3:
 
53
                    args = inspect.getfullargspec(init)[0]
 
54
                else:
 
55
                    args = inspect.getargspec(init)[0]
52
56
                self.assertFalse('message' in args,
53
57
                    ('Argument name "message" not allowed for '
54
58
                    '"errors.%s.__init__"' % c.__name__))
511
515
    def test_always_str(self):
512
516
        e = PassThroughError(u'\xb5', 'bar')
513
517
        self.assertIsInstance(e.__str__(), str)
514
 
        # In Python str(foo) *must* return a real byte string
 
518
        # In Python 2 str(foo) *must* return a real byte string
515
519
        # not a Unicode string. The following line would raise a
516
520
        # Unicode error, because it tries to call str() on the string
517
521
        # returned from e.__str__(), and it has non ascii characters
518
522
        s = str(e)
519
 
        self.assertEqual('Pass through \xc2\xb5 and bar', s)
 
523
        if PY3:
 
524
            self.assertEqual('Pass through \xb5 and bar', s)
 
525
        else:
 
526
            self.assertEqual('Pass through \xc2\xb5 and bar', s)
520
527
 
521
528
    def test_missing_format_string(self):
522
529
        e = ErrorWithNoFormat(param='randomvalue')