~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_chk_map.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-24 18:26:21 UTC
  • mfrom: (4567 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4568.
  • Revision ID: john@arbash-meinel.com-20090724182621-68s2jhoqf3pn72n7
Merge bzr.dev 4567 to resolve NEWS

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
    groupcompress,
24
25
    osutils,
25
26
    tests,
63
64
class TestCaseWithStore(tests.TestCaseWithMemoryTransport):
64
65
 
65
66
    def get_chk_bytes(self):
66
 
        # The easiest way to get a CHK store is a development6 repository and
67
 
        # then work with the chk_bytes attribute directly.
 
67
        # This creates a standalone CHK store.
68
68
        factory = groupcompress.make_pack_factory(False, False, 1)
69
69
        self.chk_bytes = factory(self.get_transport())
70
70
        return self.chk_bytes
466
466
        # updated key.
467
467
        self.assertEqual(new_root, chkmap._root_node._key)
468
468
 
 
469
    def test_apply_new_keys_must_be_new(self):
 
470
        # applying a delta (None, "a", "b") to a map with 'a' in it generates
 
471
        # an error.
 
472
        chk_bytes = self.get_chk_bytes()
 
473
        root_key = CHKMap.from_dict(chk_bytes, {("a",):"b"})
 
474
        chkmap = CHKMap(chk_bytes, root_key)
 
475
        self.assertRaises(errors.InconsistentDelta, chkmap.apply_delta,
 
476
            [(None, ("a",), "b")])
 
477
        # As an error occured, the update should have left us without changing
 
478
        # anything (the root should be unchanged).
 
479
        self.assertEqual(root_key, chkmap._root_node._key)
 
480
 
469
481
    def test_apply_delta_is_deterministic(self):
470
482
        chk_bytes = self.get_chk_bytes()
471
483
        chkmap1 = CHKMap(chk_bytes, None)