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