本文整理汇总了Python中django.utils.datastructures.MergeDict.copy方法的典型用法代码示例。如果您正苦于以下问题:Python MergeDict.copy方法的具体用法?Python MergeDict.copy怎么用?Python MergeDict.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.utils.datastructures.MergeDict
的用法示例。
在下文中一共展示了MergeDict.copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_simple_mergedict
# 需要导入模块: from django.utils.datastructures import MergeDict [as 别名]
# 或者: from django.utils.datastructures.MergeDict import copy [as 别名]
def test_simple_mergedict(self):
d1 = {"chris": "cool", "camri": "cute", "cotton": "adorable", "tulip": "snuggable", "twoofme": "firstone"}
d2 = {"chris2": "cool2", "camri2": "cute2", "cotton2": "adorable2", "tulip2": "snuggable2"}
d3 = {"chris3": "cool3", "camri3": "cute3", "cotton3": "adorable3", "tulip3": "snuggable3"}
md = MergeDict(d1, d2, d3)
self.assertEqual(md["chris"], "cool")
self.assertEqual(md["camri"], "cute")
self.assertEqual(md["twoofme"], "firstone")
md2 = md.copy()
self.assertEqual(md2["chris"], "cool")
示例2: test_simple_mergedict
# 需要导入模块: from django.utils.datastructures import MergeDict [as 别名]
# 或者: from django.utils.datastructures.MergeDict import copy [as 别名]
def test_simple_mergedict(self):
d1 = {'chris': 'cool', 'camri': 'cute', 'cotton': 'adorable',
'tulip': 'snuggable', 'twoofme': 'firstone'}
d2 = {'chris2': 'cool2', 'camri2': 'cute2', 'cotton2': 'adorable2',
'tulip2': 'snuggable2'}
d3 = {'chris3': 'cool3', 'camri3': 'cute3', 'cotton3': 'adorable3',
'tulip3': 'snuggable3'}
md = MergeDict(d1, d2, d3)
self.assertEqual(md['chris'], 'cool')
self.assertEqual(md['camri'], 'cute')
self.assertEqual(md['twoofme'], 'firstone')
md2 = md.copy()
self.assertEqual(md2['chris'], 'cool')