~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_tuned_gzip.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-20 05:26:45 UTC
  • mfrom: (1666.1.11 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060420052645-766474fe9eefd59a
Really fix short-read support in tuned_gzip. The python zlib module behaved differently than thought.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
    def decompress(self, buf):
38
38
        """Return an empty string as though we are at eof."""
39
 
        self.unused_data += buf
 
39
        # note that the zlib module *overwrites* unused data 
 
40
        # on writes after EOF.
 
41
        self.unused_data = buf
40
42
        return ''
41
43
 
42
44
 
59
61
        decompress.decompress('0')
60
62
        self.assertEqual('0', decompress.unused_data)
61
63
        # decompressing again (when the short read is read)
62
 
        # will give us the full value in the unused_data
 
64
        # will give us the latest input in the unused_data
 
65
        # this is arguably a bug in zlib but ...
63
66
        decompress.decompress('1234567')
64
 
        self.assertEqual('01234567', decompress.unused_data)
 
67
        self.assertEqual('1234567', decompress.unused_data)
65
68
 
66
69
 
67
70
class TestGzip(TestCase):