Debian Codegraph @

pypy/module/bz2/test/test_interpbz2.py

raw symbols SCIP
1 import os
2 import py
3 import pytest
4 from pypy.module.bz2.interp_bz2 import W_BZ2Decompressor, INITIAL_BUFFER_SIZE
5
6 if os.name == "nt":
7 pytest.skip("bz2 module is not available on Windows")
8
9 @pytest.yield_fixture
10 def w_decomp(space):
11 w_decomp = W_BZ2Decompressor(space)
12 yield w_decomp
13
14 @pytest.mark.parametrize('size', [1234, INITIAL_BUFFER_SIZE, 12345])
15 def test_decompress_max_length(space, w_decomp, size):
16 filename = py.path.local(__file__).new(basename='largetest.bz2')
17 with open(str(filename), 'rb') as f:
18 data = f.read()
19 result = w_decomp.decompress(data, size)
20 assert space.int_w(space.len(result)) == size