~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_chk_map.py

  • Committer: Robert Collins
  • Date: 2009-07-14 00:20:03 UTC
  • mto: This revision was merged to the branch mainline in revision 4553.
  • Revision ID: robertc@robertcollins.net-20090714002003-ingqr8vlkz5577v1
Require that added ids in inventory deltas be new.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
from bzrlib import (
22
22
    chk_map,
 
23
    errors,
23
24
    osutils,
24
25
    tests,
25
26
    )
228
229
        # updated key.
229
230
        self.assertEqual(new_root, chkmap._root_node._key)
230
231
 
 
232
    def test_apply_new_keys_must_be_new(self):
 
233
        # applying a delta (None, "a", "b") to a map with 'a' in it generates
 
234
        # an error.
 
235
        chk_bytes = self.get_chk_bytes()
 
236
        root_key = CHKMap.from_dict(chk_bytes, {("a",):"b"})
 
237
        chkmap = CHKMap(chk_bytes, root_key)
 
238
        self.assertRaises(errors.InconsistentDelta, chkmap.apply_delta,
 
239
            [(None, ("a",), "b")])
 
240
        # As an error occured, the update should have left us without changing
 
241
        # anything (the root should be unchanged).
 
242
        self.assertEqual(root_key, chkmap._root_node._key)
 
243
 
231
244
    def test_apply_delta_is_deterministic(self):
232
245
        chk_bytes = self.get_chk_bytes()
233
246
        chkmap1 = CHKMap(chk_bytes, None)