本文整理汇总了Python中multiprocessing.sharedctypes.copy方法的典型用法代码示例。如果您正苦于以下问题:Python sharedctypes.copy方法的具体用法?Python sharedctypes.copy怎么用?Python sharedctypes.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.sharedctypes
的用法示例。
在下文中一共展示了sharedctypes.copy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dict
# 需要导入模块: from multiprocessing import sharedctypes [as 别名]
# 或者: from multiprocessing.sharedctypes import copy [as 别名]
def test_dict(self):
d = self.dict()
indices = range(65, 70)
for i in indices:
d[i] = chr(i)
self.assertEqual(d.copy(), dict((i, chr(i)) for i in indices))
self.assertEqual(sorted(d.keys()), indices)
self.assertEqual(sorted(d.values()), [chr(i) for i in indices])
self.assertEqual(sorted(d.items()), [(i, chr(i)) for i in indices])
示例2: test_copy
# 需要导入模块: from multiprocessing import sharedctypes [as 别名]
# 或者: from multiprocessing.sharedctypes import copy [as 别名]
def test_copy(self):
foo = _Foo(2, 5.0)
bar = copy(foo)
foo.x = 0
foo.y = 0
self.assertEqual(bar.x, 2)
self.assertAlmostEqual(bar.y, 5.0)
#
#
#
示例3: setUp
# 需要导入模块: from multiprocessing import sharedctypes [as 别名]
# 或者: from multiprocessing.sharedctypes import copy [as 别名]
def setUp(self):
self.registry_backup = util._finalizer_registry.copy()
util._finalizer_registry.clear()
示例4: test_dict
# 需要导入模块: from multiprocessing import sharedctypes [as 别名]
# 或者: from multiprocessing.sharedctypes import copy [as 别名]
def test_dict(self):
d = self.dict()
indices = list(range(65, 70))
for i in indices:
d[i] = chr(i)
self.assertEqual(d.copy(), dict((i, chr(i)) for i in indices))
self.assertEqual(sorted(d.keys()), indices)
self.assertEqual(sorted(d.values()), [chr(i) for i in indices])
self.assertEqual(sorted(d.items()), [(i, chr(i)) for i in indices])