Skip to content

Commit e60ab84

Browse files
authored
bpo-44022: Improve the regression test. (GH-26503)
It wasn't actually detecting the regression due to the assertion being too lenient.
1 parent adef445 commit e60ab84

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
@@ -1186,7 +1186,12 @@ def test_overflowing_header_limit_after_100(self):
11861186
'r\n' * 32768
11871187
)
11881188
resp = client.HTTPResponse(FakeSocket(body))
1189-
self.assertRaises(client.HTTPException, resp.begin)
1189+
with self.assertRaises(client.HTTPException) as cm:
1190+
resp.begin()
1191+
# We must assert more because other reasonable errors that we
1192+
# do not want can also be HTTPException derived.
1193+
self.assertIn('got more than ', str(cm.exception))
1194+
self.assertIn('headers', str(cm.exception))
11901195

11911196
def test_overflowing_chunked_line(self):
11921197
body = (

0 commit comments

Comments
 (0)