本文整理汇总了Python中aiohttp.client.HttpClient._resolved_hosts方法的典型用法代码示例。如果您正苦于以下问题:Python HttpClient._resolved_hosts方法的具体用法?Python HttpClient._resolved_hosts怎么用?Python HttpClient._resolved_hosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aiohttp.client.HttpClient
的用法示例。
在下文中一共展示了HttpClient._resolved_hosts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cleanup_resolved_hosts_on_500
# 需要导入模块: from aiohttp.client import HttpClient [as 别名]
# 或者: from aiohttp.client.HttpClient import _resolved_hosts [as 别名]
def test_cleanup_resolved_hosts_on_500(self, m_request):
c = HttpClient(
[('localhost', 56777), ('localhost', 56778)], loop=self.loop)
called = False
class m:
def clear(self):
nonlocal called
called = True
def __contains__(self, key):
return True
def __getitem__(self, key):
return 'localhost'
c._resolved_hosts = m()
resp = unittest.mock.Mock()
resp.status = 500
m_request.return_value = asyncio.Future(loop=self.loop)
m_request.return_value.set_result(resp)
self.loop.run_until_complete(
c.request('get', path='/', conn_timeout=0.0001))
self.assertTrue(called)