~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2009-07-24 03:15:56 UTC
  • mfrom: (4565 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4566.
  • Revision ID: mbp@sourcefrog.net-20090724031556-5zyef6f1ixtn6r3z
merge news

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')
144
148
            ])
145
149
        self.assertEqual('a', inv.id2path('a-id'))
146
150
        a_ie = inv['a-id']
147
 
        inv.apply_delta([("a", None, "a-id", a_ie)])
 
151
        inv.apply_delta([("a", None, "a-id", None)])
148
152
        self.assertRaises(errors.NoSuchId, inv.id2path, 'a-id')
149
153
 
150
154
    def test_apply_delta_rename(self):
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
            ])