~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_groupcompress.py

  • Committer: John Arbash Meinel
  • Date: 2009-03-17 19:38:14 UTC
  • mto: (3735.2.156 brisbane-core)
  • mto: This revision was merged to the branch mainline in revision 4280.
  • Revision ID: john@arbash-meinel.com-20090317193814-ytzlgl0mbd8qtvp4
_wire_bytes() now strips groups as necessary, as does _insert_record_stream

Show diffs side-by-side

added added

removed removed

Lines of Context:
636
636
        manager = groupcompress._LazyGroupContentManager(block)
637
637
        wire_bytes = manager._wire_bytes()
638
638
        block_length = len(block.to_bytes())
639
 
        self.assertStartsWith(wire_bytes,
640
 
                              'groupcompress-block\n'
641
 
                              '8\n' # len(compress(''))
642
 
                              '0\n' # len('')
643
 
                              '%d\n'
644
 
                              % (block_length,)
645
 
                              )
 
639
        # We should have triggered a strip, since we aren't using any content
 
640
        stripped_block = manager._block.to_bytes()
 
641
        self.assertTrue(block_length > len(stripped_block))
 
642
        empty_z_header = zlib.compress('')
 
643
        self.assertEqual('groupcompress-block\n'
 
644
                         '8\n' # len(compress(''))
 
645
                         '0\n' # len('')
 
646
                         '%d\n'# compressed block len
 
647
                         '%s'  # zheader
 
648
                         '%s'  # block
 
649
                         % (len(stripped_block), empty_z_header,
 
650
                            stripped_block),
 
651
                         wire_bytes)
646
652
 
647
653
    def test__wire_bytes(self):
648
654
        entries, block = self.make_block(self._texts)