/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: 2020-02-14 03:16:54 UTC
  • mfrom: (7479.2.3 no-more-python2)
  • Revision ID: breezy.the.bot@gmail.com-20200214031654-bp1xtv2jr9nmhto3
Drop python2 support.

Merged from https://code.launchpad.net/~jelmer/brz/no-more-python2/+merge/378694

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    tests,
29
29
    urlutils,
30
30
    )
31
 
from ..sixish import (
32
 
    PY3,
33
 
    text_type,
34
 
    )
35
31
 
36
32
 
37
33
class TestErrors(tests.TestCase):
49
45
            init = getattr(c, '__init__', None)
50
46
            fmt = getattr(c, '_fmt', None)
51
47
            if init:
52
 
                if PY3:
53
 
                    args = inspect.getfullargspec(init)[0]
54
 
                else:
55
 
                    args = inspect.getargspec(init)[0]
 
48
                args = inspect.getfullargspec(init)[0]
56
49
                self.assertFalse('message' in args,
57
50
                                 ('Argument name "message" not allowed for '
58
51
                                  '"errors.%s.__init__"' % c.__name__))
365
358
        e = errors.DuplicateRecordNameError(b"n\xc3\xa5me")
366
359
        self.assertEqual(
367
360
            u"Container has multiple records with the same name: n\xe5me",
368
 
            text_type(e))
 
361
            str(e))
369
362
 
370
363
    def test_check_error(self):
371
364
        e = errors.BzrCheckError('example check failure')
409
402
        err = errors.TipChangeRejected(u'Unicode message\N{INTERROBANG}')
410
403
        self.assertEqual(
411
404
            u'Tip change rejected: Unicode message\N{INTERROBANG}',
412
 
            text_type(err))
 
405
            str(err))
413
406
 
414
407
    def test_error_from_smart_server(self):
415
408
        error_tuple = ('error', 'tuple')
508
501
        # Unicode error, because it tries to call str() on the string
509
502
        # returned from e.__str__(), and it has non ascii characters
510
503
        s = str(e)
511
 
        if PY3:
512
 
            self.assertEqual('Pass through \xb5 and bar', s)
513
 
        else:
514
 
            self.assertEqual('Pass through \xc2\xb5 and bar', s)
 
504
        self.assertEqual('Pass through \xb5 and bar', s)
515
505
 
516
506
    def test_missing_format_string(self):
517
507
        e = ErrorWithNoFormat(param='randomvalue')