當前位置: 首頁>>代碼示例>>Python>>正文


Python ServiceMock.wait方法代碼示例

本文整理匯總了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)
開發者ID:nexusriot,項目名稱:cocaine-framework-python,代碼行數:9,代碼來源:test_api.py

示例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)
開發者ID:nexusriot,項目名稱:cocaine-framework-python,代碼行數:10,代碼來源:test_api.py

示例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)
開發者ID:nexusriot,項目名稱:cocaine-framework-python,代碼行數:15,代碼來源:test_api.py

示例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))
開發者ID:nexusriot,項目名稱:cocaine-framework-python,代碼行數:7,代碼來源:test_api.py


注:本文中的cocaine.testing.mocks.ServiceMock.wait方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。