~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: 2010-05-11 14:13:31 UTC
  • mto: (5218.2.2 bytes_to_entry_c)
  • mto: This revision was merged to the branch mainline in revision 5225.
  • Revision ID: john@arbash-meinel.com-20100511141331-rizo2ez6bze3ao66
Some small tweaks to the chk_map code.

Find out that we actually weren't using the global definition because we
were assigning inside the if block. So factor that out into a helper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
467
467
        # updated key.
468
468
        self.assertEqual(new_root, chkmap._root_node._key)
469
469
 
470
 
    def test_apply_delete_to_internal_node(self):
471
 
        # applying a delta should be convert an internal root node to a leaf
472
 
        # node if the delta shrinks the map enough.
473
 
        store = self.get_chk_bytes()
474
 
        chkmap = CHKMap(store, None)
475
 
        # Add three items: 2 small enough to fit in one node, and one huge to
476
 
        # force multiple nodes.
477
 
        chkmap._root_node.set_maximum_size(100)
478
 
        chkmap.map(('small',), 'value')
479
 
        chkmap.map(('little',), 'value')
480
 
        chkmap.map(('very-big',), 'x' * 100)
481
 
        # (Check that we have constructed the scenario we want to test)
482
 
        self.assertIsInstance(chkmap._root_node, InternalNode)
483
 
        # Delete the huge item so that the map fits in one node again.
484
 
        delta = [(('very-big',), None, None)]
485
 
        chkmap.apply_delta(delta)
486
 
        self.assertCanonicalForm(chkmap)
487
 
        self.assertIsInstance(chkmap._root_node, LeafNode)
488
 
 
489
470
    def test_apply_new_keys_must_be_new(self):
490
471
        # applying a delta (None, "a", "b") to a map with 'a' in it generates
491
472
        # an error.