本文整理汇总了Python中http.HTTPStatus.HTTP_VERSION_NOT_SUPPORTED属性的典型用法代码示例。如果您正苦于以下问题:Python HTTPStatus.HTTP_VERSION_NOT_SUPPORTED属性的具体用法?Python HTTPStatus.HTTP_VERSION_NOT_SUPPORTED怎么用?Python HTTPStatus.HTTP_VERSION_NOT_SUPPORTED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类http.HTTPStatus
的用法示例。
在下文中一共展示了HTTPStatus.HTTP_VERSION_NOT_SUPPORTED属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_version_invalid
# 需要导入模块: from http import HTTPStatus [as 别名]
# 或者: from http.HTTPStatus import HTTP_VERSION_NOT_SUPPORTED [as 别名]
def test_version_invalid(self):
self.con._http_vsn = 99
self.con._http_vsn_str = 'HTTP/9.9'
self.con.putrequest('GET', '/')
self.con.endheaders()
res = self.con.getresponse()
self.assertEqual(res.status, HTTPStatus.HTTP_VERSION_NOT_SUPPORTED)
示例2: test_http_status_to_canonical_code
# 需要导入模块: from http import HTTPStatus [as 别名]
# 或者: from http.HTTPStatus import HTTP_VERSION_NOT_SUPPORTED [as 别名]
def test_http_status_to_canonical_code(self):
for status_code, expected in (
(HTTPStatus.OK, StatusCanonicalCode.OK),
(HTTPStatus.ACCEPTED, StatusCanonicalCode.OK),
(HTTPStatus.IM_USED, StatusCanonicalCode.OK),
(HTTPStatus.MULTIPLE_CHOICES, StatusCanonicalCode.OK),
(HTTPStatus.BAD_REQUEST, StatusCanonicalCode.INVALID_ARGUMENT),
(HTTPStatus.UNAUTHORIZED, StatusCanonicalCode.UNAUTHENTICATED),
(HTTPStatus.FORBIDDEN, StatusCanonicalCode.PERMISSION_DENIED),
(HTTPStatus.NOT_FOUND, StatusCanonicalCode.NOT_FOUND),
(
HTTPStatus.UNPROCESSABLE_ENTITY,
StatusCanonicalCode.INVALID_ARGUMENT,
),
(
HTTPStatus.TOO_MANY_REQUESTS,
StatusCanonicalCode.RESOURCE_EXHAUSTED,
),
(HTTPStatus.NOT_IMPLEMENTED, StatusCanonicalCode.UNIMPLEMENTED),
(HTTPStatus.SERVICE_UNAVAILABLE, StatusCanonicalCode.UNAVAILABLE),
(
HTTPStatus.GATEWAY_TIMEOUT,
StatusCanonicalCode.DEADLINE_EXCEEDED,
),
(
HTTPStatus.HTTP_VERSION_NOT_SUPPORTED,
StatusCanonicalCode.INTERNAL,
),
(600, StatusCanonicalCode.UNKNOWN),
(99, StatusCanonicalCode.UNKNOWN),
):
with self.subTest(status_code=status_code):
actual = http_status_to_canonical_code(int(status_code))
self.assertEqual(actual, expected, status_code)