<s> from paste . fixture import TestApp <EOL> from paste . gzipper import middleware <EOL> import gzip <EOL> import six <EOL> def simple_app ( environ , start_response ) : <EOL> start_response ( '<STR_LIT>' , [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> return [ b'<STR_LIT>' ] <EOL> wsgi_app = middleware ( simple_app ) <EOL> app = TestApp ( wsgi_app ) <EOL> def test_gzip ( ) : <EOL> res = app . get ( <EOL> '<STR_LIT:/>' , extra_environ = dict ( HTTP_ACCEPT_ENCODING = '<STR_LIT>' ) ) <EOL> assert int ( res . header ( '<STR_LIT>' ) ) == len ( res . body ) <EOL> assert res . body != b'<STR_LIT>' <EOL> actual = gzip . GzipFile ( fileobj = six . BytesIO ( res . body ) ) . read ( ) <EOL> assert actual == b'<STR_LIT>' </s>
