/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_groupcompress.py

  • Committer: Robert Collins
  • Date: 2009-04-27 03:47:55 UTC
  • mfrom: (4303 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4304.
  • Revision ID: robertc@robertcollins.net-20090427034755-hzs5tk304glypj9j
Fixup NEWS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
                          'different\n', sha1_2),
120
120
                         compressor.extract(('newlabel',)))
121
121
 
 
122
    def test_pop_last(self):
 
123
        compressor = self.compressor()
 
124
        _, _, _, _ = compressor.compress(('key1',),
 
125
            'some text\nfor the first entry\n', None)
 
126
        expected_lines = list(compressor.chunks)
 
127
        _, _, _, _ = compressor.compress(('key2',),
 
128
            'some text\nfor the second entry\n', None)
 
129
        compressor.pop_last()
 
130
        self.assertEqual(expected_lines, compressor.chunks)
 
131
 
122
132
 
123
133
class TestPyrexGroupCompressor(TestGroupCompressor):
124
134
 
437
447
        # And the decompressor is finalized
438
448
        self.assertIs(None, block._z_content_decompressor)
439
449
 
 
450
    def test__dump(self):
 
451
        dup_content = 'some duplicate content\nwhich is sufficiently long\n'
 
452
        key_to_text = {('1',): dup_content + '1 unique\n',
 
453
                       ('2',): dup_content + '2 extra special\n'}
 
454
        locs, block = self.make_block(key_to_text)
 
455
        self.assertEqual([('f', len(key_to_text[('1',)])),
 
456
                          ('d', 21, len(key_to_text[('2',)]),
 
457
                           [('c', 2, len(dup_content)),
 
458
                            ('i', len('2 extra special\n'), '')
 
459
                           ]),
 
460
                         ], block._dump())
 
461
 
440
462
 
441
463
class TestCaseWithGroupCompressVersionedFiles(tests.TestCaseWithTransport):
442
464