Example #1
0
 def test_resulting_file(self):
     """Make sure UnBZip2 changes are pushed through to actual file."""
     import tempfile
     import os
     (fd, fn) = tempfile.mkstemp()
     os.close(fd)
     try:
         f = open(fn, "w")
         f.write(gz_compress("hello world!"))
         f.close()
         f = UnGZip(open(fn, "r+"))
         f.read(6)
         f.write("Ausralia!")
         f.seek(-6, 1)
         f.write("tralia!")
         f.close()
         self.assertEquals(open(fn).read(), gz_compress("hello Australia!"))
     finally:
         os.unlink(fn)
Example #2
0
    def test_resulting_file(self):
        """Make sure UnBZip2 changes are pushed through to actual file."""
        import tempfile
        import os

        (fd, fn) = tempfile.mkstemp()
        os.close(fd)
        try:
            f = open(fn, "w")
            f.write(gz_compress("hello world!"))
            f.close()
            f = UnGZip(open(fn, "r+"))
            f.read(6)
            f.write("Ausralia!")
            f.seek(-6, 1)
            f.write("tralia!")
            f.close()
            self.assertEquals(open(fn).read(), gz_compress("hello Australia!"))
        finally:
            os.unlink(fn)
Example #3
0
 def makeFile(self, contents, mode):
     s = StringIO(gz_compress(contents))
     f = UnGZip(s, mode)
     f.getvalue = def_getvalue_maybe_buffered(f, s, gz_decompress)
     return f
Example #4
0
 def makeFile(self, contents, mode):
     s = StringIO(gz_compress(contents))
     f = UnGZip(s, mode)
     f.getvalue = def_getvalue_maybe_buffered(f, s, gz_decompress)
     return f