~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

  • Committer: Vincent Ladeuil
  • Date: 2008-09-11 19:36:38 UTC
  • mfrom: (3703 +trunk)
  • mto: (3705.1.1 trunk2)
  • mto: This revision was merged to the branch mainline in revision 3708.
  • Revision ID: v.ladeuil+lp@free.fr-20080911193638-wtjyc1kcmacc6t1f
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
            "Error: the reason why",
46
46
            str(error))
47
47
 
 
48
    def test_dirstate_corrupt(self):
 
49
        error = errors.DirstateCorrupt('.bzr/checkout/dirstate',
 
50
                                       'trailing garbage: "x"')
 
51
        self.assertEqualDiff("The dirstate file (.bzr/checkout/dirstate)"
 
52
            " appears to be corrupt: trailing garbage: \"x\"",
 
53
            str(error))
 
54
 
48
55
    def test_disabled_method(self):
49
56
        error = errors.DisabledMethod("class name")
50
57
        self.assertEqualDiff(
541
548
            'Tip change rejected: Unicode message\xe2\x80\xbd',
542
549
            str(err))
543
550
 
 
551
    def test_error_from_smart_server(self):
 
552
        error_tuple = ('error', 'tuple')
 
553
        err = errors.ErrorFromSmartServer(error_tuple)
 
554
        self.assertEquals(
 
555
            "Error received from smart server: ('error', 'tuple')", str(err))
 
556
 
 
557
    def test_untranslateable_error_from_smart_server(self):
 
558
        error_tuple = ('error', 'tuple')
 
559
        orig_err = errors.ErrorFromSmartServer(error_tuple)
 
560
        err = errors.UnknownErrorFromSmartServer(orig_err)
 
561
        self.assertEquals(
 
562
            "Server sent an unexpected error: ('error', 'tuple')", str(err))
 
563
 
544
564
 
545
565
class PassThroughError(errors.BzrError):
546
566