~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_inv.py

  • Committer: Robert Collins
  • Date: 2009-07-13 05:44:06 UTC
  • mto: This revision was merged to the branch mainline in revision 4553.
  • Revision ID: robertc@robertcollins.net-20090713054406-py4vt6uns5yyoya0
Look for trivial issues with new_path and entry being out of sync in deltas.

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
        paths = {}
160
160
        parents = set()
161
161
        for old, new, id, entry in delta:
162
 
            if entry is None:
 
162
            if None in (new, entry):
163
163
                continue
164
164
            paths[new] = (entry.file_id, entry.kind)
165
165
            parents.add(osutils.dirname(new))
337
337
        self.assertRaises(errors.InconsistentDelta, self.apply_delta, self,
338
338
            inv, delta)
339
339
 
 
340
    def test_mismatched_new_path_entry_None(self):
 
341
        inv = self.get_empty_inventory()
 
342
        delta = [(None, u'path', 'id', None)]
 
343
        self.assertRaises(errors.InconsistentDelta, self.apply_delta, self,
 
344
            inv, delta)
 
345
 
 
346
    def test_mismatched_new_path_None_entry(self):
 
347
        inv = self.get_empty_inventory()
 
348
        file1 = inventory.InventoryFile('id1', 'path', inv.root.file_id)
 
349
        file1.revision = 'result'
 
350
        file1.text_size = 0
 
351
        file1.text_sha1 = ""
 
352
        delta = [(u"path", None, 'id1', file1)]
 
353
        self.assertRaises(errors.InconsistentDelta, self.apply_delta, self,
 
354
            inv, delta)
 
355
 
340
356
    def test_parent_is_not_directory(self):
341
357
        inv = self.get_empty_inventory()
342
358
        file1 = inventory.InventoryFile('id1', 'path', inv.root.file_id)