本文整理匯總了Python中util.UpnpPunch._parse_for_errors方法的典型用法代碼示例。如果您正苦於以下問題:Python UpnpPunch._parse_for_errors方法的具體用法?Python UpnpPunch._parse_for_errors怎麽用?Python UpnpPunch._parse_for_errors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類util.UpnpPunch
的用法示例。
在下文中一共展示了UpnpPunch._parse_for_errors方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_parse_for_errors_error
# 需要導入模塊: from util import UpnpPunch [as 別名]
# 或者: from util.UpnpPunch import _parse_for_errors [as 別名]
def test_parse_for_errors_error(self, httplib_response):
soap_error = ('<document>'
'<errorCode>500</errorCode>'
'<errorDescription>Bad request</errorDescription>'
'</document>')
rsp = httplib_response(status=500, body=soap_error)
with pytest.raises(upnp.IGDError) as exc:
upnp._parse_for_errors(rsp)
assert 'SOAP request error' in exc.value.message
示例2: test_parse_for_errors_good_rsp
# 需要導入模塊: from util import UpnpPunch [as 別名]
# 或者: from util.UpnpPunch import _parse_for_errors [as 別名]
def test_parse_for_errors_good_rsp(self, httplib_response):
rsp = httplib_response(status=200)
assert rsp == upnp._parse_for_errors(rsp)
示例3: test_parse_for_errors_bad_rsp
# 需要導入模塊: from util import UpnpPunch [as 別名]
# 或者: from util.UpnpPunch import _parse_for_errors [as 別名]
def test_parse_for_errors_bad_rsp(self, httplib_response):
rsp = httplib_response(status=500)
with pytest.raises(upnp.IGDError) as exc:
upnp._parse_for_errors(rsp)
assert 'Unable to parse' in exc.value.message