本文整理汇总了Python中cocaine.testing.mocks.ServiceMock.execute方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceMock.execute方法的具体用法?Python ServiceMock.execute怎么用?Python ServiceMock.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocaine.testing.mocks.ServiceMock
的用法示例。
在下文中一共展示了ServiceMock.execute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_GetSingleChunkMultipleTimesAfterWaiting
# 需要导入模块: from cocaine.testing.mocks import ServiceMock [as 别名]
# 或者: from cocaine.testing.mocks.ServiceMock import execute [as 别名]
def test_GetSingleChunkMultipleTimesAfterWaiting(self):
s = ServiceMock(chunks=[1], T=self.T, ioLoop=self.io_loop)
f1 = s.execute()
f1.wait()
f1.get()
f2 = s.execute()
f2.wait()
r2 = f2.get()
self.assertEqual(1, r2)
示例2: test_GetMultipleChunksMultipleTimes
# 需要导入模块: from cocaine.testing.mocks import ServiceMock [as 别名]
# 或者: from cocaine.testing.mocks.ServiceMock import execute [as 别名]
def test_GetMultipleChunksMultipleTimes(self):
s = ServiceMock(chunks=[1, 2, 3], T=self.T, ioLoop=self.io_loop)
f1 = s.execute()
f1.get()
f1.get()
f1.get()
f2 = s.execute()
r21 = f2.get()
r22 = f2.get()
r23 = f2.get()
self.assertEqual(1, r21)
self.assertEqual(2, r22)
self.assertEqual(3, r23)
示例3: test_GetSingleChunkMultipleTimes
# 需要导入模块: from cocaine.testing.mocks import ServiceMock [as 别名]
# 或者: from cocaine.testing.mocks.ServiceMock import execute [as 别名]
def test_GetSingleChunkMultipleTimes(self):
s = ServiceMock(chunks=[1], T=self.T, ioLoop=self.io_loop)
s.execute().get()
r2 = s.execute().get()
self.assertEqual(1, r2)