@@ -1320,7 +1320,7 @@ async def test_oserror_on_write_bytes(
1320
1320
loop : asyncio .AbstractEventLoop , conn : mock .Mock
1321
1321
) -> None :
1322
1322
req = ClientRequest ("POST" , URL ("http://python.org/" ), loop = loop )
1323
- req .body = b"test data"
1323
+ req .body = b"test data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1324
1324
1325
1325
writer = WriterMock ()
1326
1326
writer .write .side_effect = OSError
@@ -1668,7 +1668,7 @@ async def test_write_bytes_with_content_length_limit(
1668
1668
data = b"Hello World"
1669
1669
req = ClientRequest ("post" , URL ("http://python.org/" ), loop = loop )
1670
1670
1671
- req .body = data
1671
+ req .body = data # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1672
1672
1673
1673
writer = StreamWriter (protocol = conn .protocol , loop = loop )
1674
1674
# Use content_length=5 to truncate data
@@ -1705,7 +1705,7 @@ async def gen() -> AsyncIterator[bytes]:
1705
1705
1706
1706
req .body = gen () # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1707
1707
else :
1708
- req .body = data
1708
+ req .body = data # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1709
1709
1710
1710
writer = StreamWriter (protocol = conn .protocol , loop = loop )
1711
1711
# Use content_length=7 to truncate at the middle of Part2
@@ -1755,7 +1755,7 @@ async def test_warn_if_unclosed_payload_via_body_setter(
1755
1755
ResourceWarning ,
1756
1756
match = "The previous request body contains unclosed resources" ,
1757
1757
):
1758
- req .body = b"new data"
1758
+ req .body = b"new data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1759
1759
1760
1760
await req .close ()
1761
1761
@@ -1773,7 +1773,7 @@ async def test_no_warn_for_autoclose_payload_via_body_setter(
1773
1773
# Setting body again should not trigger warning since previous payload has autoclose=True
1774
1774
with warnings .catch_warnings (record = True ) as warning_list :
1775
1775
warnings .simplefilter ("always" )
1776
- req .body = b"new data"
1776
+ req .body = b"new data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1777
1777
1778
1778
# Filter out any non-ResourceWarning warnings
1779
1779
resource_warnings = [
@@ -1803,7 +1803,7 @@ async def test_no_warn_for_consumed_payload_via_body_setter(
1803
1803
# Setting body again should not trigger warning since previous payload is consumed
1804
1804
with warnings .catch_warnings (record = True ) as warning_list :
1805
1805
warnings .simplefilter ("always" )
1806
- req .body = b"new data"
1806
+ req .body = b"new data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1807
1807
1808
1808
# Filter out any non-ResourceWarning warnings
1809
1809
resource_warnings = [
@@ -1922,7 +1922,7 @@ async def test_body_setter_closes_previous_payload(
1922
1922
req ._body = mock_payload
1923
1923
1924
1924
# Update body with new data using setter
1925
- req .body = b"new body data"
1925
+ req .body = b"new body data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1926
1926
1927
1927
# Verify the previous payload was closed using _close
1928
1928
mock_payload ._close .assert_called_once ()
@@ -2051,7 +2051,7 @@ async def test_warn_stacklevel_points_to_user_code(
2051
2051
with warnings .catch_warnings (record = True ) as warning_list :
2052
2052
warnings .simplefilter ("always" , ResourceWarning )
2053
2053
# This line should be reported as the warning source
2054
- req .body = b"new data" # LINE TO BE REPORTED
2054
+ req .body = b"new data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892 # LINE TO BE REPORTED
2055
2055
2056
2056
# Find the ResourceWarning
2057
2057
resource_warnings = [
0 commit comments