~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

  • Committer: Andrew Bennetts
  • Date: 2007-03-28 07:08:42 UTC
  • mfrom: (2380 +trunk)
  • mto: (2018.5.146 hpss)
  • mto: This revision was merged to the branch mainline in revision 2414.
  • Revision ID: andrew.bennetts@canonical.com-20070328070842-r843houy668oxb9o
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
class TestErrors(TestCaseWithTransport):
32
32
 
 
33
    def test_duplicate_file_id(self):
 
34
        error = errors.DuplicateFileId('a_file_id', 'foo')
 
35
        self.assertEqualDiff('File id {a_file_id} already exists in inventory'
 
36
                             ' as foo', str(error))
 
37
 
33
38
    def test_inventory_modified(self):
34
39
        error = errors.InventoryModified("a tree to be repred")
35
40
        self.assertEqualDiff("The current inventory for the tree 'a tree to "
46
51
        error = errors.InstallFailed([None])
47
52
        self.assertEqual("Could not install revisions:\nNone", str(error))
48
53
 
 
54
    def test_lock_active(self):
 
55
        error = errors.LockActive("lock description")
 
56
        self.assertEqualDiff("The lock for 'lock description' is in use and "
 
57
            "cannot be broken.",
 
58
            str(error))
 
59
 
49
60
    def test_knit_header_error(self):
50
61
        error = errors.KnitHeaderError('line foo\n', 'path/to/file')
51
62
        self.assertEqual("Knit header error: 'line foo\\n' unexpected"
81
92
            "atree.",
82
93
            str(error))
83
94
 
 
95
    def test_no_such_revision_in_tree(self):
 
96
        error = errors.NoSuchRevisionInTree("atree", "anid")
 
97
        self.assertEqualDiff("The revision id anid is not present in the tree "
 
98
            "atree.",
 
99
            str(error))
 
100
        self.assertIsInstance(error, errors.NoSuchRevision)
 
101
 
84
102
    def test_not_write_locked(self):
85
103
        error = errors.NotWriteLocked('a thing to repr')
86
104
        self.assertEqualDiff("'a thing to repr' is not write locked but needs "
87
105
            "to be.",
88
106
            str(error))
89
107
 
 
108
    def test_read_only_lock_error(self):
 
109
        error = errors.ReadOnlyLockError('filename', 'error message')
 
110
        self.assertEqualDiff("Cannot acquire write lock on filename."
 
111
                             " error message", str(error))
 
112
 
90
113
    def test_too_many_concurrent_requests(self):
91
114
        error = errors.TooManyConcurrentRequests("a medium")
92
115
        self.assertEqualDiff("The medium 'a medium' has reached its concurrent "