本文整理匯總了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)