8000 bpo-44022: Improve the regression test. (GH-26503) (GH-26507) · python/cpython@fee9642 · GitHub
[go: up one dir, main page]

Skip to content

Commit fee9642

Browse files
bpo-44022: Improve the regression test. (GH-26503) (GH-26507)
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 <greg@krypto.org>
1 parent c723d51 commit fee9642

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
@@ -1004,7 +1004,12 @@ def test_overflowing_header_limit_after_100(self):
10041004
'r\n' * 32768
10051005
)
10061006
resp = client.HTTPResponse(FakeSocket(body))
1007-
self.assertRaises(client.HTTPException, resp.begin)
1007+
with self.assertRaises(client.HTTPException) as cm:
1008+
resp.begin()
1009+
# We must assert more because other reasonable errors that we
1010+
# do not want can also be HTTPException derived.
1011+
self.assertIn('got more than ', str(cm.exception))
1012+
self.assertIn('headers', str(cm.exception))
10081013

10091014
def test_overflowing_chunked_line(self):
10101015
body = (

0 commit comments

Comments
 (0)
0