~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

  • Committer: Aaron Bentley
  • Date: 2008-03-03 16:52:41 UTC
  • mfrom: (3144.3.11 fix-conflict-handling)
  • mto: This revision was merged to the branch mainline in revision 3250.
  • Revision ID: aaron@aaronbentley.com-20080303165241-0k2c7ggs6kr9q6hf
Merge with fix-conflict-handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
2
2
#   Authors: Robert Collins <robert.collins@canonical.com>
3
3
#            and others
4
4
#
22
22
    bzrdir,
23
23
    errors,
24
24
    symbol_versioning,
 
25
    urlutils,
25
26
    )
26
27
from bzrlib.tests import TestCase, TestCaseWithTransport
27
28
 
28
29
 
29
30
class TestErrors(TestCaseWithTransport):
30
31
 
 
32
    def test_corrupt_dirstate(self):
 
33
        error = errors.CorruptDirstate('path/to/dirstate', 'the reason why')
 
34
        self.assertEqualDiff(
 
35
            "Inconsistency in dirstate file path/to/dirstate.\n"
 
36
            "Error: the reason why",
 
37
            str(error))
 
38
 
31
39
    def test_disabled_method(self):
32
40
        error = errors.DisabledMethod("class name")
33
41
        self.assertEqualDiff(
50
58
            'It supports versions "(4, 5, 6)" to "(7, 8, 9)".',
51
59
            str(error))
52
60
 
 
61
    def test_inconsistent_delta(self):
 
62
        error = errors.InconsistentDelta('path', 'file-id', 'reason for foo')
 
63
        self.assertEqualDiff(
 
64
            "An inconsistent delta was supplied involving 'path', 'file-id'\n"
 
65
            "reason: reason for foo",
 
66
            str(error))
 
67
 
53
68
    def test_in_process_transport(self):
54
69
        error = errors.InProcessTransport('fpp')
55
70
        self.assertEqualDiff(
121
136
        error = errors.MediumNotConnected("a medium")
122
137
        self.assertEqualDiff(
123
138
            "The medium 'a medium' is not connected.", str(error))
124
 
        
 
139
 
 
140
    def test_no_public_branch(self):
 
141
        b = self.make_branch('.')
 
142
        error = errors.NoPublicBranch(b)
 
143
        url = urlutils.unescape_for_display(b.base, 'ascii')
 
144
        self.assertEqualDiff(
 
145
            'There is no public branch set for "%s".' % url, str(error))
 
146
 
125
147
    def test_no_repo(self):
126
148
        dir = bzrdir.BzrDir.create(self.get_url())
127
149
        error = errors.NoRepositoryPresent(dir)