From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 3 Jun 2021 04:10:22 +0000 (-0700) Subject: bpo-44022: Improve the regression test. (GH-26503) X-Git-Tag: archive/raspbian/3.9.2-1+rpi1+deb11u2^2~25 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=99602a7aa925980b4d933f75458c5f3c8cd25a14;p=python3.9.git bpo-44022: Improve the regression test. (GH-26503) It wasn't actually detecting the regression due to the assertion being too lenient. (cherry picked from commit e60ab843cbb016fb6ff8b4f418641ac05a9b2fcc) Co-authored-by: Gregory P. Smith Gbp-Pq: Name 0006-bpo-44022-Improve-the-regression-test.-GH-26503.patch --- diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 8304d58..0e04231 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -1010,7 +1010,12 @@ class BasicTest(TestCase): '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 = (