当前位置: 首页>>代码示例>>Python>>正文


Python Spec.bar方法代码示例

本文整理汇总了Python中lancelot.Spec.bar方法的典型用法代码示例。如果您正苦于以下问题:Python Spec.bar方法的具体用法?Python Spec.bar怎么用?Python Spec.bar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lancelot.Spec的用法示例。


在下文中一共展示了Spec.bar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: should_verify_specified_collaborations

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import bar [as 别名]
 def should_verify_specified_collaborations(self):
     ''' after start_collaborating, collaborations should be verified '''
     spec = Spec(MockSpec(name='a'))
     spec.when(spec.start_collaborating())
     spec.then(spec.foo())
     msg = 'should not be collaborating with a.foo()'
     spec.should_raise(UnmetSpecification(msg))
 
     spec = Spec(MockSpec(name='b'))
     spec.when(spec.foo(), spec.start_collaborating())
     spec.then(spec.bar())
     msg = 'should be collaborating with b.foo(), not b.bar()'
     spec.should_raise(UnmetSpecification(msg))
 
     spec = Spec(MockSpec(name='c'))
     spec.when(spec.foo(), spec.bar(), spec.start_collaborating())
     spec.then(spec.foo()).should_not_raise(UnmetSpecification)
     msg = 'should be collaborating with c.bar(), not c.baz()'
     spec.then(spec.baz()).should_raise(UnmetSpecification(msg))
     
     mock = MockSpec(name='d')
     mock.foo().times(2).will_return('camelot')
     spec = Spec(mock)
     spec.when(spec.start_collaborating())
     spec.then(spec.foo()).should_not_raise(UnmetSpecification)
     spec.then(spec.foo()).should_not_raise(UnmetSpecification)
     msg = 'should not be collaborating with d.foo()'
     spec.then(spec.foo()).should_raise(UnmetSpecification(msg))
开发者ID:gbremer,项目名称:lancelot,代码行数:30,代码来源:mocking_spec.py

示例2: using_mock_call

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import bar [as 别名]
def using_mock_call():
    ''' collaboration specification should use MockCall '''
    spec = Spec(MockSpec())
    spec.foo().should_be(Type(MockCall))
    spec.bar(12).should_be(Type(MockCall))
    spec.baz(keyword='named argument').should_be(Type(MockCall))
开发者ID:gbremer,项目名称:lancelot,代码行数:8,代码来源:mocking_spec.py


注:本文中的lancelot.Spec.bar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。