@@ -5589,7 +5589,7 @@ async def handler(request: web.Request) -> web.Response:
5589
5589
5590
5590
5591
5591
async def test_stream_reader_total_raw_bytes (aiohttp_client : AiohttpClient ) -> None :
5592
- """ Test whether StreamReader.total_raw_bytes returns the number of bytes downloaded """
5592
+ """Test whether StreamReader.total_raw_bytes returns the number of bytes downloaded"""
5593
5593
source_data = b"@dKal^pH>1h|YW1:c2J$" * 4096
5594
5594
5595
5595
async def handler (request : web .Request ) -> web .Response :
@@ -5603,21 +5603,27 @@ async def handler(request: web.Request) -> web.Response:
5603
5603
client = await aiohttp_client (app )
5604
5604
5605
5605
# Check for decompressed data
5606
- async with client .get ("/" , headers = {"Accept-Encoding" : "gzip" }, auto_decompress = True ) as resp :
5606
+ async with client .get (
5607
+ "/" , headers = {"Accept-Encoding" : "gzip" }, auto_decompress = True
5608
+ ) as resp :
5607
5609
assert resp .headers ["Content-Encoding" ] == "gzip"
5608
5610
data = await resp .content .read ()
5609
5611
assert len (data ) == len (source_data )
5610
5612
assert resp .content .total_raw_bytes == int (resp .headers ["Content-Length" ])
5611
5613
5612
5614
# Check for compressed data
5613
- async with client .get ("/" , headers = {"Accept-Encoding" : "gzip" }, auto_decompress = False ) as resp :
5615
+ async with client .get (
5616
+ "/" , headers = {"Accept-Encoding" : "gzip" }, auto_decompress = False
5617
+ ) as resp :
5614
5618
assert resp .headers ["Content-Encoding" ] == "gzip"
5615
5619
data = await resp .content .read ()
5616
5620
assert resp .content .total_raw_bytes == len (data )
5617
5621
assert resp .content .total_raw_bytes == int (resp .headers ["Content-Length" ])
5618
5622
5619
5623
# Check for non-compressed data
5620
- async with client .get ("/" , headers = {"Accept-Encoding" : "identity" }, auto_decompress = True ) as resp :
5624
+ async with client .get (
5625
+ "/" , headers = {"Accept-Encoding" : "identity" }, auto_decompress = True
5626
+ ) as resp :
5621
5627
assert "Content-Encoding" not in resp .headers
5622
5628
data = await resp .content .read ()
5623
5629
assert resp .content .total_raw_bytes == len (data )
0 commit comments