本文整理汇总了Python中tornado.httputil.HTTPHeaders.copy方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPHeaders.copy方法的具体用法?Python HTTPHeaders.copy怎么用?Python HTTPHeaders.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.httputil.HTTPHeaders
的用法示例。
在下文中一共展示了HTTPHeaders.copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_copy
# 需要导入模块: from tornado.httputil import HTTPHeaders [as 别名]
# 或者: from tornado.httputil.HTTPHeaders import copy [as 别名]
def test_copy(self):
all_pairs = [('A', '1'), ('A', '2'), ('B', 'c')]
h1 = HTTPHeaders()
for k, v in all_pairs:
h1.add(k, v)
h2 = h1.copy()
h3 = copy.copy(h1)
h4 = copy.deepcopy(h1)
for headers in [h1, h2, h3, h4]:
# All the copies are identical, no matter how they were
# constructed.
self.assertEqual(list(sorted(headers.get_all())), all_pairs)
for headers in [h2, h3, h4]:
# Neither the dict or its member lists are reused.
self.assertIsNot(headers, h1)
self.assertIsNot(headers.get_list('A'), h1.get_list('A'))