@@ -1641,7 +1641,7 @@ class ExtendedReadTestContentLengthKnown(ExtendedReadTest):
16411641 _header , _body = ExtendedReadTest .lines .split ('\r \n \r \n ' , 1 )
16421642 lines = _header + f'\r \n Content-Length: { len (_body )} \r \n \r \n ' + _body
16431643
1644- def _test_incomplete_read (self , read_meth ):
1644+ def _test_incomplete_read (self , read_meth , expected_none ):
16451645 resp = self .resp
16461646 # Reduce the size of content the response object will read to
16471647 # cause the incomplete read.
@@ -1663,17 +1663,20 @@ def _test_incomplete_read(self, read_meth):
16631663 else :
16641664 expected_partial = b""
16651665 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 )
16671670 self .assertTrue (resp .isclosed ())
16681671
16691672 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 )
16711674
16721675 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 )
16741677
16751678 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 )
16771680
16781681
16791682class ExtendedReadTestChunked (ExtendedReadTest ):
0 commit comments