Skip to content

Commit 5df4abd

Browse files
bpo-44022: Improve the regression test. (GH-26503)
It wasn't actually detecting the regression due to the assertion being too lenient. (cherry picked from commit e60ab84) Co-authored-by: Gregory P. Smith <[email protected]>
1 parent 991693a commit 5df4abd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/test/test_httplib.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,12 @@ def test_overflowing_header_limit_after_100(self):
10111011
'r\n' * 32768
10121012
)
10131013
resp = client.HTTPResponse(FakeSocket(body))
1014-
self.assertRaises(client.HTTPException, resp.begin)
1014+
with self.assertRaises(client.HTTPException) as cm:
1015+
resp.begin()
1016+
# We must assert more because other reasonable errors that we
1017+
# do not want can also be HTTPException derived.
1018+
self.assertIn('got more than ', str(cm.exception))
1019+
self.assertIn('headers', str(cm.exception))
10151020

10161021
def test_overflowing_chunked_line(self):
10171022
body = (

0 commit comments

Comments
 (0)