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


Python ServiceMock.get方法代碼示例

本文整理匯總了Python中cocaine.testing.mocks.ServiceMock.get方法的典型用法代碼示例。如果您正苦於以下問題:Python ServiceMock.get方法的具體用法?Python ServiceMock.get怎麽用?Python ServiceMock.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cocaine.testing.mocks.ServiceMock的用法示例。


在下文中一共展示了ServiceMock.get方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_GetMultipleChunks

# 需要導入模塊: from cocaine.testing.mocks import ServiceMock [as 別名]
# 或者: from cocaine.testing.mocks.ServiceMock import get [as 別名]
 def test_GetMultipleChunks(self):
     f = ServiceMock(chunks=[1, 2, 3], T=self.T, ioLoop=self.io_loop).execute()
     r1 = f.get()
     r2 = f.get()
     r3 = f.get()
     self.assertEqual(1, r1)
     self.assertEqual(2, r2)
     self.assertEqual(3, r3)
開發者ID:nexusriot,項目名稱:cocaine-framework-python,代碼行數:10,代碼來源:test_api.py

示例2: test_GetMultipleMixChunksWithComplexChain

# 需要導入模塊: from cocaine.testing.mocks import ServiceMock [as 別名]
# 或者: from cocaine.testing.mocks.ServiceMock import get [as 別名]
 def test_GetMultipleMixChunksWithComplexChain(self):
     def middleMan(result):
         r = result.get()
         if r == 2:
             raise Exception('=(')
         yield r
     f = ServiceMock(chunks=[1, 2, 3], T=self.T, ioLoop=self.io_loop).execute()
     f.then(middleMan)
     self.assertEqual(1, f.get())
     self.assertRaises(Exception, f.get)
     self.assertEqual(3, f.get())
開發者ID:devlato,項目名稱:cocaine-framework-python,代碼行數:13,代碼來源:test_api.py

示例3: test_GetSingleChunkAfterMultipleWaiting

# 需要導入模塊: from cocaine.testing.mocks import ServiceMock [as 別名]
# 或者: from cocaine.testing.mocks.ServiceMock import get [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

示例4: test_GetMultipleChunksDeferredly

# 需要導入模塊: from cocaine.testing.mocks import ServiceMock [as 別名]
# 或者: from cocaine.testing.mocks.ServiceMock import get [as 別名]
 def test_GetMultipleChunksDeferredly(self):
     f1 = ServiceMock(chunks=[1], T=self.T, ioLoop=self.io_loop).execute()
     f2 = ServiceMock(chunks=[2], T=self.T, ioLoop=self.io_loop).execute()
     self.assertEqual(2, f2.get())
     self.assertEqual(1, f1.get())
開發者ID:nexusriot,項目名稱:cocaine-framework-python,代碼行數:7,代碼來源:test_api.py

示例5: test_PartialGenerator

# 需要導入模塊: from cocaine.testing.mocks import ServiceMock [as 別名]
# 或者: from cocaine.testing.mocks.ServiceMock import get [as 別名]
 def test_PartialGenerator(self):
     f = ServiceMock(chunks=[1, 2, 3], T=self.T, ioLoop=self.io_loop).execute()
     collect = [f.get()]
     for r in f:
         collect.append(r)
     self.assertEqual([1, 2, 3], collect)
開發者ID:nexusriot,項目名稱:cocaine-framework-python,代碼行數:8,代碼來源:test_api.py

示例6: test_GetExtraChunksResultsInChokeEvent

# 需要導入模塊: from cocaine.testing.mocks import ServiceMock [as 別名]
# 或者: from cocaine.testing.mocks.ServiceMock import get [as 別名]
 def test_GetExtraChunksResultsInChokeEvent(self):
     f = ServiceMock(chunks=[1], T=self.T, ioLoop=self.io_loop).execute()
     r = f.get()
     self.assertEqual(1, r)
     self.assertRaises(ChokeEvent, f.get)
     self.assertRaises(ChokeEvent, f.get)
開發者ID:nexusriot,項目名稱:cocaine-framework-python,代碼行數:8,代碼來源:test_api.py

示例7: test_GetMultipleMixChunks

# 需要導入模塊: from cocaine.testing.mocks import ServiceMock [as 別名]
# 或者: from cocaine.testing.mocks.ServiceMock import get [as 別名]
 def test_GetMultipleMixChunks(self):
     f = ServiceMock(chunks=[ValueError("Oops1"), 1, IOError("Oops2")], T=self.T, ioLoop=self.io_loop).execute()
     self.assertRaises(ValueError, f.get)
     self.assertEqual(1, f.get())
     self.assertRaises(IOError, f.get)
開發者ID:nexusriot,項目名稱:cocaine-framework-python,代碼行數:7,代碼來源:test_api.py

示例8: test_GetSingleChunk

# 需要導入模塊: from cocaine.testing.mocks import ServiceMock [as 別名]
# 或者: from cocaine.testing.mocks.ServiceMock import get [as 別名]
 def test_GetSingleChunk(self):
     f = ServiceMock(chunks=[1], T=self.T, ioLoop=self.io_loop).execute()
     r = f.get()
     self.assertEqual(1, r)
開發者ID:nexusriot,項目名稱:cocaine-framework-python,代碼行數:6,代碼來源:test_api.py


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