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