Skip to content

Commit 852297c

Browse files
authored
Cleanup some type ignores in the client request tests (#11020)
1 parent faea0d6 commit 852297c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test_client_request.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from aiohttp.compression_utils import ZLibBackend
3838
from aiohttp.connector import Connection
3939
from aiohttp.http import HttpVersion10, HttpVersion11, StreamWriter
40+
from aiohttp.multipart import MultipartWriter
4041
from aiohttp.typedefs import LooseCookies
4142

4243

@@ -757,7 +758,8 @@ async def test_formdata_boundary_from_headers(
757758
)
758759
async with await req.send(conn):
759760
await asyncio.sleep(0)
760-
assert req.body._boundary == boundary.encode() # type: ignore[union-attr]
761+
assert isinstance(req.body, MultipartWriter)
762+
assert req.body._boundary == boundary.encode()
761763

762764

763765
async def test_post_data(loop: asyncio.AbstractEventLoop, conn: mock.Mock) -> None:
@@ -767,7 +769,8 @@ async def test_post_data(loop: asyncio.AbstractEventLoop, conn: mock.Mock) -> No
767769
)
768770
resp = await req.send(conn)
769771
assert "/" == req.url.path
770-
assert b"life=42" == req.body._value # type: ignore[union-attr]
772+
assert isinstance(req.body, payload.Payload)
773+
assert b"life=42" == req.body._value
771774
assert "application/x-www-form-urlencoded" == req.headers["CONTENT-TYPE"]
772775
await req.close()
773776
resp.close()
@@ -806,7 +809,8 @@ async def test_get_with_data(loop: asyncio.AbstractEventLoop) -> None:
806809
meth, URL("http://python.org/"), data={"life": "42"}, loop=loop
807810
)
808811
assert "/" == req.url.path
809-
assert b"life=42" == req.body._value # type: ignore[union-attr]
812+
assert isinstance(req.body, payload.Payload)
813+
assert b"life=42" == req.body._value
810814
await req.close()
811815

812816

0 commit comments

Comments
 (0)