[issue23442] http.client.REQUEST_HEADER_FIELDS_TOO_LARGE renamed in 3.5
Demian Brecht
report at bugs.python.org
Fri Feb 13 01:49:49 CET 2015
Demian Brecht added the comment:
I've attached a patch with fixes for both cases and the tests added by
Berker. Thanks guys.
----------
Added file: http://bugs.python.org/file38122/issue23442_1.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23442>
_______________________________________
-------------- next part --------------
diff -r e548ab4ce71d Lib/http/__init__.py
--- a/Lib/http/__init__.py Mon Feb 09 19:49:00 2015 +0000
+++ b/Lib/http/__init__.py Thu Feb 12 16:48:03 2015 -0800
@@ -93,7 +93,7 @@
'URI is too long')
UNSUPPORTED_MEDIA_TYPE = (415, 'Unsupported Media Type',
'Entity body in unsupported format')
- REQUEST_RANGE_NOT_SATISFIABLE = (416,
+ REQUESTED_RANGE_NOT_SATISFIABLE = (416,
'Request Range Not Satisfiable',
'Cannot satisfy request range')
EXPECTATION_FAILED = (417, 'Expectation Failed',
@@ -107,7 +107,7 @@
TOO_MANY_REQUESTS = (429, 'Too Many Requests',
'The user has sent too many requests in '
'a given amount of time ("rate limiting")')
- REQUEST_HEADER_FIELD_TOO_LARGE = (431,
+ REQUEST_HEADER_FIELDS_TOO_LARGE = (431,
'Request Header Field Too Large',
'The server is unwilling to process the request because its header '
'fields are too large')
diff -r e548ab4ce71d Lib/test/test_httplib.py
--- a/Lib/test/test_httplib.py Mon Feb 09 19:49:00 2015 +0000
+++ b/Lib/test/test_httplib.py Thu Feb 12 16:48:03 2015 -0800
@@ -924,6 +924,66 @@
def test_responses(self):
self.assertEqual(client.responses[client.NOT_FOUND], "Not Found")
+ def test_client_constants(self):
+ expected = [
+ 'CONTINUE',
+ 'SWITCHING_PROTOCOLS',
+ 'PROCESSING',
+ 'OK',
+ 'CREATED',
+ 'ACCEPTED',
+ 'NON_AUTHORITATIVE_INFORMATION',
+ 'NO_CONTENT',
+ 'RESET_CONTENT',
+ 'PARTIAL_CONTENT',
+ 'MULTI_STATUS',
+ 'IM_USED',
+ 'MULTIPLE_CHOICES',
+ 'MOVED_PERMANENTLY',
+ 'FOUND',
+ 'SEE_OTHER',
+ 'NOT_MODIFIED',
+ 'USE_PROXY',
+ 'TEMPORARY_REDIRECT',
+ 'BAD_REQUEST',
+ 'UNAUTHORIZED',
+ 'PAYMENT_REQUIRED',
+ 'FORBIDDEN',
+ 'NOT_FOUND',
+ 'METHOD_NOT_ALLOWED',
+ 'NOT_ACCEPTABLE',
+ 'PROXY_AUTHENTICATION_REQUIRED',
+ 'REQUEST_TIMEOUT',
+ 'CONFLICT',
+ 'GONE',
+ 'LENGTH_REQUIRED',
+ 'PRECONDITION_FAILED',
+ 'REQUEST_ENTITY_TOO_LARGE',
+ 'REQUEST_URI_TOO_LONG',
+ 'UNSUPPORTED_MEDIA_TYPE',
+ 'REQUESTED_RANGE_NOT_SATISFIABLE',
+ 'EXPECTATION_FAILED',
+ 'UNPROCESSABLE_ENTITY',
+ 'LOCKED',
+ 'FAILED_DEPENDENCY',
+ 'UPGRADE_REQUIRED',
+ 'PRECONDITION_REQUIRED',
+ 'TOO_MANY_REQUESTS',
+ 'REQUEST_HEADER_FIELDS_TOO_LARGE',
+ 'INTERNAL_SERVER_ERROR',
+ 'NOT_IMPLEMENTED',
+ 'BAD_GATEWAY',
+ 'SERVICE_UNAVAILABLE',
+ 'GATEWAY_TIMEOUT',
+ 'HTTP_VERSION_NOT_SUPPORTED',
+ 'INSUFFICIENT_STORAGE',
+ 'NOT_EXTENDED',
+ 'NETWORK_AUTHENTICATION_REQUIRED',
+ ]
+ for const in expected:
+ with self.subTest(constant=const):
+ self.assertTrue(hasattr(client, const))
+
class SourceAddressTest(TestCase):
def setUp(self):
More information about the Python-bugs-list
mailing list