本文整理匯總了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)