本文整理汇总了Python中lancelot.Spec.baz方法的典型用法代码示例。如果您正苦于以下问题:Python Spec.baz方法的具体用法?Python Spec.baz怎么用?Python Spec.baz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lancelot.Spec
的用法示例。
在下文中一共展示了Spec.baz方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: should_verify_specified_collaborations
# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import baz [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))
示例2: using_mock_call
# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import baz [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))