[Python-checkins] bpo-44022: Improve the regression test. (GH-26503)
miss-islington
webhook-mailer at python.org
Thu Jun 3 00:04:29 EDT 2021
https://github.com/python/cpython/commit/98e5a7975d99b58d511f171816ecdfb13d5cca18
commit: 98e5a7975d99b58d511f171816ecdfb13d5cca18
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-06-02T21:04:20-07:00
summary:
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 <greg at krypto.org>
files:
M Lib/test/test_httplib.py
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index e9272569ecc53..8265b8d1d6d2d 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -1186,7 +1186,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 = (
More information about the Python-checkins
mailing list