Example #1
0
    def test_should_be_able_to_compress_0_bytes_of_data(self):
        input = [b'']

        sio = six.BytesIO()
        for compressed in compress(input):
            sio.write(compressed)
        sio.seek(0)

        result = decompress_data(sio)
        self.assertEqual(result, b'')
Example #2
0
    def test_should_be_able_to_compress_0_bytes_of_data(self):
        input = ['']

        sio = StringIO.StringIO()
        for compressed in compress(input):
            sio.write(compressed)
        sio.seek(0)

        result = decompress_data(sio)
        self.assertEqual(result, '')
Example #3
0
    def test_should_be_able_to_compress_a_list_of_data(self):
        input = ['123', '45']

        sio = StringIO.StringIO()
        for compressed in compress(input):
            sio.write(compressed)
        sio.seek(0)

        result = decompress_data(sio)
        self.assertEqual(result, ''.join(input))
Example #4
0
    def test_should_be_able_to_compress_data_coming_from_a_generator(self):
        input = '12345'
        def gen():
            yield input

        sio = StringIO.StringIO()
        for compressed in compress(gen()):
            sio.write(compressed)
        sio.seek(0)

        result = decompress_data(sio)
        self.assertEqual(result, input)
Example #5
0
    def test_should_be_able_to_compress_data_coming_from_a_generator(self):
        input = b'12345'

        def gen():
            yield input

        sio = six.BytesIO()
        for compressed in compress(gen()):
            sio.write(compressed)
        sio.seek(0)

        result = decompress_data(sio)
        self.assertEqual(result, input)
Example #6
0
 def test_should_be_able_to_set_the_compression_level(self):
     list(compress(b'', compresslevel=1))
Example #7
0
 def test_should_be_able_to_set_the_compression_level(self):
     list(compress('', compresslevel=1))