本文整理匯總了Python中lancelot.Spec.it方法的典型用法代碼示例。如果您正苦於以下問題:Python Spec.it方法的具體用法?Python Spec.it怎麽用?Python Spec.it使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lancelot.Spec
的用法示例。
在下文中一共展示了Spec.it方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: given_when_then_behaviour
# 需要導入模塊: from lancelot import Spec [as 別名]
# 或者: from lancelot.Spec import it [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: should_contain_behaviour
# 需要導入模塊: from lancelot import Spec [as 別名]
# 或者: from lancelot.Spec import it [as 別名]
def should_contain_behaviour():
''' should_ and should_not_ contain methods delegate to Contain '''
spec = Spec(['brave', 'brave', 'sir robin'])
spec.it().should_contain('brave')
spec.it().should_not_contain('bravely ran away')