@@ -1261,7 +1261,7 @@ def read(self, decode=False):
1261
1261
1262
1262
async def test_oserror_on_write_bytes (loop , conn ) -> None :
1263
1263
req = ClientRequest ("POST" , URL ("http://python.org/" ), loop = loop )
1264
- req .body = b"test data"
1264
+ req .body = b"test data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1265
1265
1266
1266
writer = WriterMock ()
1267
1267
writer .write .side_effect = OSError
@@ -1618,7 +1618,7 @@ async def test_write_bytes_with_content_length_limit(
1618
1618
data = b"Hello World"
1619
1619
req = ClientRequest ("post" , URL ("http://python.org/" ), loop = loop )
1620
1620
1621
- req .body = data
1621
+ req .body = data # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1622
1622
1623
1623
writer = StreamWriter (protocol = conn .protocol , loop = loop )
1624
1624
# Use content_length=5 to truncate data
@@ -1655,7 +1655,7 @@ async def gen() -> AsyncIterator[bytes]:
1655
1655
1656
1656
req .body = gen () # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1657
1657
else :
1658
- req .body = data
1658
+ req .body = data # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1659
1659
1660
1660
writer = StreamWriter (protocol = conn .protocol , loop = loop )
1661
1661
# Use content_length=7 to truncate at the middle of Part2
@@ -1705,7 +1705,7 @@ async def test_warn_if_unclosed_payload_via_body_setter(
1705
1705
ResourceWarning ,
1706
1706
match = "The previous request body contains unclosed resources" ,
1707
1707
):
1708
- req .body = b"new data"
1708
+ req .body = b"new data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1709
1709
1710
1710
await req .close ()
1711
1711
@@ -1723,7 +1723,7 @@ async def test_no_warn_for_autoclose_payload_via_body_setter(
1723
1723
# Setting body again should not trigger warning since previous payload has autoclose=True
1724
1724
with warnings .catch_warnings (record = True ) as warning_list :
1725
1725
warnings .simplefilter ("always" )
1726
- req .body = b"new data"
1726
+ req .body = b"new data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1727
1727
1728
1728
# Filter out any non-ResourceWarning warnings
1729
1729
resource_warnings = [
@@ -1753,7 +1753,7 @@ async def test_no_warn_for_consumed_payload_via_body_setter(
1753
1753
# Setting body again should not trigger warning since previous payload is consumed
1754
1754
with warnings .catch_warnings (record = True ) as warning_list :
1755
1755
warnings .simplefilter ("always" )
1756
- req .body = b"new data"
1756
+ req .body = b"new data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1757
1757
1758
1758
# Filter out any non-ResourceWarning warnings
1759
1759
resource_warnings = [
@@ -1872,7 +1872,7 @@ async def test_body_setter_closes_previous_payload(
1872
1872
req ._body = mock_payload
1873
1873
1874
1874
# Update body with new data using setter
1875
- req .body = b"new body data"
1875
+ req .body = b"new body data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892
1876
1876
1877
1877
# Verify the previous payload was closed using _close
1878
1878
mock_payload ._close .assert_called_once ()
@@ -2001,7 +2001,7 @@ async def test_warn_stacklevel_points_to_user_code(
2001
2001
with warnings .catch_warnings (record = True ) as warning_list :
2002
2002
warnings .simplefilter ("always" , ResourceWarning )
2003
2003
# This line should be reported as the warning source
2004
- req .body = b"new data" # LINE TO BE REPORTED
2004
+ req .body = b"new data" # type: ignore[assignment] # https://github.com/python/mypy/issues/12892 # LINE TO BE REPORTED
2005
2005
2006
2006
# Find the ResourceWarning
2007
2007
resource_warnings = [
0 commit comments