本文整理汇总了Python中lancelot.Spec.append方法的典型用法代码示例。如果您正苦于以下问题:Python Spec.append方法的具体用法?Python Spec.append怎么用?Python Spec.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lancelot.Spec
的用法示例。
在下文中一共展示了Spec.append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: given_when_then_behaviour
# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import append [as 别名]
def given_when_then_behaviour():
''' given empty list when item appended then list length should be one '''
spec = Spec([])
spec.when(spec.append(object())).then(spec.it()).should_be(Length(1))
def empty_list():
''' descriptive name for fn returning an empty list '''
return []
spec = Spec(type([]), given=empty_list)
spec.when(spec.append('monty')).then(spec.it()).should_be(Length(1))
示例2: external_then_behaviour
# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import append [as 别名]
def external_then_behaviour():
''' Spec for then()... actions that call outside the spec itself.
Note that the action on the spec is invoked in client code with parens():
spec.then( * spec.__len__() * ).should_be(1)
but the action outside the spec is NOT:
spec.then( * 'they called him brian'.__len__ * ).should_be(21)
'''
spec = Spec([])
spec.when(spec.append('brian'))
spec.then(spec.__len__()).should_be(1)
spec.then('they called him brian'.__len__).should_be(21)