#NEWLINE# def test_gzipped_streaming( self ) : #NEWLINE# #INDENT# import zlib #NEWLINE# compress = zlib . compressobj ( 6 , zlib . DEFLATED , ( 16 + zlib . MAX_WBITS ) ) #NEWLINE# data = compress . compress ( b'foo' ) #NEWLINE# data += compress . flush ( ) #NEWLINE# fp = BytesIO ( stream ) #NEWLINE# resp = HTTPResponse ( fp , headers = { #NEWLINE# #INDENT# 'content-encoding' : 'gzip' , #NEWLINE# #UNINDENT# } , preload_content = False ) #NEWLINE# stream = resp . stream ( 2 ) #NEWLINE# self . assertEqual ( next ( stream ) , b'f' ) #NEWLINE# self . assertEqual ( next ( stream ) , b'oo' ) #NEWLINE# self . assertRaises ( StopIteration , next , stream )