本文整理汇总了Python中celery.local.Proxy.extend方法的典型用法代码示例。如果您正苦于以下问题:Python Proxy.extend方法的具体用法?Python Proxy.extend怎么用?Python Proxy.extend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.local.Proxy
的用法示例。
在下文中一共展示了Proxy.extend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_listproxy
# 需要导入模块: from celery.local import Proxy [as 别名]
# 或者: from celery.local.Proxy import extend [as 别名]
def test_listproxy(self):
v = []
x = Proxy(lambda: v)
x.append(1)
x.extend([2, 3, 4])
self.assertEqual(x[0], 1)
self.assertEqual(x[:-1], [1, 2, 3])
del(x[-1])
self.assertEqual(x[:-1], [1, 2])
x[0] = 10
self.assertEqual(x[0], 10)
self.assertIn(10, x)
self.assertEqual(len(x), 3)
self.assertTrue(iter(x))
示例2: test_listproxy
# 需要导入模块: from celery.local import Proxy [as 别名]
# 或者: from celery.local.Proxy import extend [as 别名]
def test_listproxy(self):
v = []
x = Proxy(lambda: v)
x.append(1)
x.extend([2, 3, 4])
self.assertEqual(x[0], 1)
self.assertEqual(x[:-1], [1, 2, 3])
del(x[-1])
self.assertEqual(x[:-1], [1, 2])
x[0] = 10
self.assertEqual(x[0], 10)
self.assertIn(10, x)
self.assertEqual(len(x), 3)
self.assertTrue(iter(x))
x[0:2] = [1, 2]
del(x[0:2])
self.assertTrue(str(x))
if sys.version_info[0] < 3:
self.assertEqual(x.__cmp__(object()), -1)
示例3: test_listproxy
# 需要导入模块: from celery.local import Proxy [as 别名]
# 或者: from celery.local.Proxy import extend [as 别名]
def test_listproxy(self):
v = []
x = Proxy(lambda: v)
x.append(1)
x.extend([2, 3, 4])
assert x[0] == 1
assert x[:-1] == [1, 2, 3]
del(x[-1])
assert x[:-1] == [1, 2]
x[0] = 10
assert x[0] == 10
assert 10 in x
assert len(x) == 3
assert iter(x)
x[0:2] = [1, 2]
del(x[0:2])
assert str(x)
if sys.version_info[0] < 3:
assert x.__cmp__(object()) == -1