本文整理汇总了Python中lancelot.Spec.include方法的典型用法代码示例。如果您正苦于以下问题:Python Spec.include方法的具体用法?Python Spec.include怎么用?Python Spec.include使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lancelot.Spec
的用法示例。
在下文中一共展示了Spec.include方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: should_increment
# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import include [as 别名]
def should_increment(self):
''' total() should increment as verifiable_fn is included '''
spec = Spec(AllVerifiable, given=silent_listener)
spec.total().should_be(0)
spec.when(spec.include(raise_index_error))
spec.then(spec.total()).should_be(1)
spec.when(spec.include(dont_raise_index_error))
spec.then(spec.total()).should_be(2)
示例2: all_verif_failfast_behaviour
# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import include [as 别名]
def all_verif_failfast_behaviour():
''' verify(fail_fast=True) should stop after the first unmet specification
or unexpected exception'''
spec = Spec(AllVerifiable, given=silent_listener)
spec.when(spec.include(raise_index_error),
spec.include(dont_raise_index_error))
spec.then(spec.verify(fail_fast=True))
spec.should_be({'total':2, 'verified':0, 'unverified':2, 'fail_fast':True})
spec = Spec(AllVerifiable, given=silent_listener)
spec.when(spec.include(unmet_specification),
spec.include(dont_raise_index_error))
spec.then(spec.verify(fail_fast=True))
spec.should_be({'total':2, 'verified':0, 'unverified':2, 'fail_fast':True})
示例3: should_return_all_results
# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import include [as 别名]
def should_return_all_results(self):
''' verify() should return the result of all attempted / successful
verifications '''
spec = Spec(AllVerifiable, given=silent_listener)
spec.verify().should_be({'total':0, 'verified':0, 'unverified':0})
spec = Spec(AllVerifiable, given=silent_listener)
spec.when(spec.include(number_one))
spec.then(spec.verify())
spec.should_be({'total':1, 'verified':1, 'unverified':0})
spec.when(spec.include(raise_index_error))
spec.then(spec.verify())
spec.should_be({'total':2, 'verified':1, 'unverified':1})
示例4: should_verify_each_item
# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import include [as 别名]
def should_verify_each_item(self):
''' verify() should execute each included item '''
a_list = []
lambda_list_append1 = lambda: a_list.append(0)
lambda_list_append2 = lambda: a_list.extend((1, 2))
spec = Spec(AllVerifiable, given=silent_listener)
spec.when(spec.include(lambda_list_append1),
spec.include(lambda_list_append2),
spec.verify())
spec.then(a_list.__len__).should_be(3)
示例5: notification_behaviour
# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import include [as 别名]
def notification_behaviour():
''' listener should receive notifications AllVerifiable.verify() '''
listener = MockSpec()
all_verifiable_with_mock_listener = AllVerifiable(listener)
results = {'total': 3, 'verified': 1, 'unverified': 2}
spec = Spec(all_verifiable_with_mock_listener)
spec.when(spec.include(string_abc),
spec.include(raise_index_error),
spec.include(unmet_specification))
spec.then(spec.verify())
spec.should_collaborate_with(
listener.all_verifiable_starting(all_verifiable_with_mock_listener),
listener.verification_started(string_abc),
listener.specification_met(string_abc),
listener.verification_started(raise_index_error),
listener.unexpected_exception(raise_index_error, Type(IndexError)),
listener.verification_started(unmet_specification),
listener.specification_unmet(unmet_specification,
Type(UnmetSpecification)),
listener.all_verifiable_ending(all_verifiable_with_mock_listener,
results),
and_result = results)
示例6: all_verif_include_behaviour
# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import include [as 别名]
def all_verif_include_behaviour():
''' include() method should return self '''
all_verifiable = silent_listener()
spec = Spec(all_verifiable)
spec.include(string_abc).should_be(all_verifiable)
示例7: should_ignore_duplicates
# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import include [as 别名]
def should_ignore_duplicates(self):
''' total() should ignore duplicate include()s '''
spec = Spec(AllVerifiable, given=silent_listener)
spec.when(spec.include(raise_index_error),
spec.include(raise_index_error))
spec.then(spec.total()).should_be(1)