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

Skip to content

Commit 0389426

Browse files
bpo-44022: Improve the regression test. (GH-26503) (#26506)
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 ae5dcf5 commit 0389426

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
@@ -1009,7 +1009,12 @@ def test_overflowing_header_limit_after_100(self):
10091009
'r\n' * 32768
10101010
)
10111011
resp = client.HTTPResponse(FakeSocket(body))
1012-
self.assertRaises(client.HTTPException, resp.begin)
1012+
with self.assertRaises(client.HTTPException) as cm:
1013+
resp.begin()
1014+
# We must assert more because other reasonable errors that we
1015+
# do not want can also be HTTPException derived.
1016+
self.assertIn('got more than ', str(cm.exception))
1017+
self.assertIn('headers', str(cm.exception))
10131018

10141019
def test_overflowing_chunked_line(self):
10151020
body = (

0 commit comments

Comments
 (0)
0