File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,28 @@ def test_write_readonly_file():
50
50
error .match (r"write\(\) on read-only IGzipFile object" )
51
51
52
52
53
+ def test_igzip_reader_readall ():
54
+ data = io .BytesIO (COMPRESSED_DATA )
55
+ test = igzip ._IGzipReader (data )
56
+ assert test .read (- 1 ) == DATA
57
+
58
+
59
+ def test_igzip_reader_read_zero ():
60
+ data = io .BytesIO (COMPRESSED_DATA )
61
+ test = igzip ._IGzipReader (data )
62
+ assert test .read (0 ) == b""
63
+
64
+
65
+ def test_igzipfile_read_truncated ():
66
+ # Chop of trailer (8 bytes) and part of DEFLATE stream
67
+ data = io .BytesIO (COMPRESSED_DATA [:- 10 ])
68
+ test = igzip .GzipFile (fileobj = data , mode = "rb" )
69
+ with pytest .raises (EOFError ) as error :
70
+ test .read ()
71
+ error .match ("Compressed file ended before the end-of-stream marker was "
72
+ "reached" )
73
+
74
+
53
75
@pytest .mark .parametrize ("level" , range (1 , 10 ))
54
76
def test_decompress_stdin_stdout (capsysbinary , level ):
55
77
"""Test if the command line can decompress data that has been compressed
You can’t perform that action at this time.
0 commit comments