Skip to content

Commit

Permalink
bpo-44022: Improve the regression test. (GH-26503) (GH-26508)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
miss-islington and gpshead authored Jun 3, 2021
1 parent 6f743e7 commit 1b6f4e5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Lib/test/test_httplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,12 @@ def test_overflowing_header_limit_after_100(self):
'r\n' * 32768
)
resp = client.HTTPResponse(FakeSocket(body))
self.assertRaises(client.HTTPException, resp.begin)
with self.assertRaises(client.HTTPException) as cm:
resp.begin()
# We must assert more because other reasonable errors that we
# do not want can also be HTTPException derived.
self.assertIn('got more than ', str(cm.exception))
self.assertIn('headers', str(cm.exception))

def test_overflowing_chunked_line(self):
body = (
Expand Down

0 comments on commit 1b6f4e5

Please sign in to comment.