File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1696,16 +1696,16 @@ def test_readline_incomplete_read_with_incomplete_line(self):
16961696 """
16971697 resp = self .resp
16981698 content = resp .fp .read ()
1699- # Truncate the content to the last newline .
1700- content = content [: content . rindex ( b" \n " ) - 1 ]
1699+ # Remove last newline and following bytes .
1700+ content = content . rsplit ( b' \n ' , 1 )[ 0 ]
17011701 resp .fp = io .BytesIO (content )
17021702 with self .assertRaises (client .IncompleteRead ) as cm :
17031703 while True :
17041704 data = resp .readline ()
17051705 if not data :
17061706 break
17071707 exception = cm .exception
1708- self .assertEqual (exception .partial , content .split ( b" \n " )[ - 1 ])
1708+ self .assertEqual (exception .partial , content .rsplit ( b' \n ' , 1 )[ 1 ])
17091709 self .assertIsNone (exception .expected )
17101710 self .assertTrue (resp .isclosed ())
17111711
You can’t perform that action at this time.
0 commit comments