@@ -1641,7 +1641,7 @@ class ExtendedReadTestContentLengthKnown(ExtendedReadTest):
1641
1641
_header , _body = ExtendedReadTest .lines .split ('\r \n \r \n ' , 1 )
1642
1642
lines = _header + f'\r \n Content-Length: { len (_body )} \r \n \r \n ' + _body
1643
1643
1644
- def _test_incomplete_read (self , read_meth ):
1644
+ def _test_incomplete_read (self , read_meth , expected_none ):
1645
1645
resp = self .resp
1646
1646
# Reduce the size of content the response object will read to
1647
1647
# cause the incomplete read.
@@ -1663,17 +1663,20 @@ def _test_incomplete_read(self, read_meth):
1663
1663
else :
1664
1664
expected_partial = b""
1665
1665
self .assertEqual (exception .partial , expected_partial )
1666
- self .assertEqual (exception .expected , 1 )
1666
+ if expected_none :
1667
+ self .assertIsNone (exception .expected )
1668
+ else :
1669
+ self .assertEqual (exception .expected , 1 )
1667
1670
self .assertTrue (resp .isclosed ())
1668
1671
1669
1672
def test_read_incomplete_read (self ):
1670
- self ._test_incomplete_read (self .resp .read )
1673
+ self ._test_incomplete_read (self .resp .read , expected_none = False )
1671
1674
1672
1675
def test_read1_incomplete_read (self ):
1673
- self ._test_incomplete_read (self .resp .read1 )
1676
+ self ._test_incomplete_read (self .resp .read1 , expected_none = True )
1674
1677
1675
1678
def test_readline_incomplete_read (self ):
1676
- self ._test_incomplete_read (self .resp .readline )
1679
+ self ._test_incomplete_read (self .resp .readline , expected_none = True )
1677
1680
1678
1681
1679
1682
class ExtendedReadTestChunked (ExtendedReadTest ):
0 commit comments