Skip to content

Commit 75f3dd8

Browse files
committed
Add test for compression level
1 parent 3c4b6dd commit 75f3dd8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/test_igzip_cli.py renamed to tests/test_igzip.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
# SOFTWARE.
2020

21-
"""Tests for the igzip CLI. Uses pytest which works better than unittest for
22-
these sort of tests. Meant to complement the gzip module compliance tests.
23-
It should improve coverage as well."""
21+
"""Tests for igzip that are not tested with the gzip_compliance tests taken
22+
from CPython. Uses pytest which is easier to work with. Meant to complement
23+
the gzip module compliance tests. It should improve coverage as well."""
2424

2525
import gzip
2626
import io
@@ -34,6 +34,12 @@
3434
COMPRESSED_DATA = gzip.compress(DATA)
3535

3636

37+
def test_wrong_compresslevel_igzipfile():
38+
with pytest.raises(ValueError) as error:
39+
igzip.IGzipFile("test.gz", mode="wb", compresslevel=6)
40+
error.match("Compression level should be between 0 and 3")
41+
42+
3743
@pytest.mark.parametrize("level", range(1, 10))
3844
def test_decompress_stdin_stdout(capsysbinary, level):
3945
"""Test if the command line can decompress data that has been compressed

0 commit comments

Comments
 (0)