当前位置: 首页>>代码示例>>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;未经允许,请勿转载。