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

Skip to content

Commit 1b6f4e5

Browse files
bpo-44022: Improve the regression test. (GH-26503) (GH-26508)
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 6f743e7 commit 1b6f4e5

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
@@ -977,7 +977,12 @@ def test_overflowing_header_limit_after_100(self):
977977
'r\n' * 32768
978978
)
979979
resp = client.HTTPResponse(FakeSocket(body))
980-
self.assertRaises(client.HTTPException, resp.begin)
980+
with self.assertRaises(client.HTTPException) as cm:
981+
resp.begin()
982+
# We must assert more because other reasonable errors that we
983+
# do not want can also be HTTPException derived.
984+
self.assertIn('got more than ', str(cm.exception))
985+
self.assertIn('headers', str(cm.exception))
981986

982987
def test_overflowing_chunked_line(self):
983988
body = (

0 commit comments

Comments
 (0)
0