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