~bzr-pqm/bzr/1.17

« back to all changes in this revision

Viewing changes to bzrlib/tests/inventory_implementations/basics.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-07-10 06:35:38 UTC
  • mfrom: (4505.5.9 apply-inventory-delta)
  • Revision ID: pqm@pqm.ubuntu.com-20090710063538-2hap9pxafqfe6r20
(robertc) First tranche of inventory-delta application validation.
        (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
    def test_error_encoding(self):
113
113
        inv = self.make_inventory('tree-root')
114
114
        inv.add(InventoryFile('a-id', u'\u1234', 'tree-root'))
115
 
        try:
116
 
            inv.add(InventoryFile('b-id', u'\u1234', 'tree-root'))
117
 
        except errors.BzrError, e:
118
 
            self.assertContainsRe(str(e), u'\u1234'.encode('utf-8'))
119
 
        else:
120
 
            self.fail('BzrError not raised')
 
115
        e = self.assertRaises(errors.InconsistentDelta, inv.add,
 
116
            InventoryFile('b-id', u'\u1234', 'tree-root'))
 
117
        self.assertContainsRe(str(e), r'\\u1234')
121
118
 
122
119
    def test_add_recursive(self):
123
120
        parent = InventoryDirectory('src-id', 'src', 'tree-root')
129
126
 
130
127
 
131
128
class TestInventoryApplyDelta(TestInventory):
 
129
    """A subset of the inventory delta application tests.
 
130
 
 
131
    See test_inv which has comprehensive delta application tests for
 
132
    inventories, dirstate, and repository based inventories, unlike the tests
 
133
    here which only test in-memory implementations that can support a plain
 
134
    'apply_delta'.
 
135
    """
132
136
 
133
137
    def test_apply_delta_add(self):
134
138
        inv = self.make_inventory('tree-root')
161
165
    def test_apply_delta_illegal(self):
162
166
        # A file-id cannot appear in a delta more than once
163
167
        inv = self.make_inventory('tree-root')
164
 
        self.assertRaises(AssertionError, inv.apply_delta, [
 
168
        self.assertRaises(errors.InconsistentDelta, inv.apply_delta, [
165
169
            ("a", "a", "id-1", InventoryFile('id-1', 'a', 'tree-root')),
166
170
            ("a", "b", "id-1", InventoryFile('id-1', 'b', 'tree-root')),
167
171
            ])