~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_inv.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-17 18:41:26 UTC
  • mto: This revision was merged to the branch mainline in revision 4461.
  • Revision ID: john@arbash-meinel.com-20090617184126-i5u6odzoka4sk566
Clean upt the test_inv tests that assumed _root_node was real and not just a key.

Show diffs side-by-side

added added

removed removed

Lines of Context:
297
297
        inv.root.revision = "rootrev"
298
298
        chk_bytes = self.get_chk_bytes()
299
299
        chk_inv = CHKInventory.from_inventory(chk_bytes, inv, 120)
 
300
        chk_inv.id_to_entry._ensure_root()
300
301
        self.assertEqual(120, chk_inv.id_to_entry._root_node.maximum_size)
 
302
        self.assertEqual(1, chk_inv.id_to_entry._root_node._key_width)
 
303
        p_id_basename = chk_inv.parent_id_basename_to_file_id
 
304
        p_id_basename._ensure_root()
 
305
        self.assertEqual(120, p_id_basename._root_node.maximum_size)
 
306
        self.assertEqual(2, p_id_basename._root_node._key_width)
301
307
 
302
308
    def test___iter__(self):
303
309
        inv = Inventory()
454
460
        # new_inv should be the same as reference_inv.
455
461
        self.assertEqual(reference_inv.revision_id, new_inv.revision_id)
456
462
        self.assertEqual(reference_inv.root_id, new_inv.root_id)
 
463
        reference_inv.id_to_entry._ensure_root()
 
464
        new_inv.id_to_entry._ensure_root()
457
465
        self.assertEqual(reference_inv.id_to_entry._root_node._key,
458
466
            new_inv.id_to_entry._root_node._key)
459
467
 
473
481
        reference_inv = CHKInventory.from_inventory(chk_bytes, inv)
474
482
        delta = [(None, "A",  "A-id", a_entry)]
475
483
        new_inv = base_inv.create_by_apply_delta(delta, "expectedid")
 
484
        reference_inv.id_to_entry._ensure_root()
 
485
        reference_inv.parent_id_basename_to_file_id._ensure_root()
 
486
        new_inv.id_to_entry._ensure_root()
 
487
        new_inv.parent_id_basename_to_file_id._ensure_root()
476
488
        # new_inv should be the same as reference_inv.
477
489
        self.assertEqual(reference_inv.revision_id, new_inv.revision_id)
478
490
        self.assertEqual(reference_inv.root_id, new_inv.root_id)