diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-06-02 21:38:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-03 00:38:31 -0400 |
| commit | 1b6f4e5e13ebd1f957b47f7415b53d0869bdbac6 (patch) | |
| tree | d41ae3d6ed7692e4fe0a5ee91738e0b57cf9c919 | |
| parent | 6f743e7a4da904f61dfa84cc7d7385e4dcc79ac5 (diff) | |
| download | cpython-git-1b6f4e5e13ebd1f957b47f7415b53d0869bdbac6.tar.gz | |
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 e60ab843cbb016fb6ff8b4f418641ac05a9b2fcc)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
| -rw-r--r-- | Lib/test/test_httplib.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 0db287507c..0b42923ce6 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -977,7 +977,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 = ( |
