当前位置: 首页>>代码示例>>Python>>正文


Python helpers.failure函数代码示例

本文整理汇总了Python中spec.helpers.failure函数的典型用法代码示例。如果您正苦于以下问题:Python failure函数的具体用法?Python failure怎么用?Python failure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了failure函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: it_should_fail_if_actual_raises_expected_exception_with_message

            def it_should_fail_if_actual_raises_expected_exception_with_message():
                message = 'Foo error'
                failure_message = 'not to raise AttributeError with message {} but message was {}'.format(
                    repr(message), repr(message))

                def callback():
                    raise AttributeError(message)

                with failure(callback, failure_message):
                    expect(callback).not_to.raise_error(AttributeError, message)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:10,代码来源:expect_spec.py

示例2: it_should_fail_if_actual_is_greater_than_expected_

 def it_should_fail_if_actual_is_greater_than_expected_():
     with failure(5, 'not to be greater or equal to 4'):
         expect(5).not_to.be.greater_or_equal_to(4)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:3,代码来源:expect_spec.py

示例3: it_should_fail_if_actual_does_not_equal_expected_

 def it_should_fail_if_actual_does_not_equal_expected_():
     with failure(1, 'to be equal 2'):
         expect(1).to.be.equal(2)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:3,代码来源:expect_spec.py

示例4: it_should_fail_if_actual_has_the_expected_length

                def it_should_fail_if_actual_has_the_expected_length():
                    actual = 'foo'

                    with failure(actual, 'not to have length 3 but was 3'):
                        expect(actual).not_to.have.length(3)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:5,代码来源:expect_spec.py

示例5: it_should_fail_if_actual_has_key_in_kwargs_but_not_in_args

 def it_should_fail_if_actual_has_key_in_kwargs_but_not_in_args():
     with failure(_.dct, "not to have key 'bar' with value 0 but was 0"):
         expect(_.dct).not_to.have.keys('foo', bar=0)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:3,代码来源:expect_spec.py

示例6: it_should_fail_if_actual_has_key_in_kwargs_with_value

 def it_should_fail_if_actual_has_key_in_kwargs_with_value():
     with failure(_.dct, "not to have key 'bar' with value 0 but was 0"):
         expect(_.dct).not_to.have.keys(baz=0, bar=0)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:3,代码来源:expect_spec.py

示例7: it_should_fail_if_actual_raises_expected_exception_with_different_message

            def it_should_fail_if_actual_raises_expected_exception_with_different_message():
                def callback():
                    raise AttributeError('bar')

                with failure(callback, "to raise AttributeError with message 'foo' but message was 'bar'"):
                    expect(callback).to.raise_error(AttributeError, 'foo')
开发者ID:jvrsantacruz,项目名称:expects,代码行数:6,代码来源:expect_spec.py

示例8: it_should_fail_if_actual_has_expected_key

 def it_should_fail_if_actual_has_expected_key():
     with failure(_.dct, "not to have key 'bar'"):
         expect(_.dct).not_to.have.key('bar')
开发者ID:jvrsantacruz,项目名称:expects,代码行数:3,代码来源:expect_spec.py

示例9: it_should_fail_if_actual_is_true_

 def it_should_fail_if_actual_is_true_():
     with failure(True, 'not to be True'):
         expect(True).not_to.be.true
开发者ID:jvrsantacruz,项目名称:expects,代码行数:3,代码来源:expect_spec.py

示例10: it_should_fail_if_actual_is_within_expected_range

 def it_should_fail_if_actual_is_within_expected_range():
     with failure(5, 'not to be within 4, 7'):
         expect(5).not_to.be.within(4, 7)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:3,代码来源:expect_spec.py

示例11: it_should_fail_if_actual_does_not_raise_exception

            def it_should_fail_if_actual_does_not_raise_exception():
                callback = lambda: None

                with failure(callback, 'to raise AttributeError but None raised'):
                    expect(callback).to.raise_error(AttributeError)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:5,代码来源:expect_spec.py

示例12: it_should_fail_if_actual_is_equal_to_expected_

 def it_should_fail_if_actual_is_equal_to_expected_():
     with failure(5, 'not to be less or equal to 5'):
         expect(5).not_to.be.less_or_equal_to(5)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:3,代码来源:expect_spec.py

示例13: it_should_fail_if_actual_is_less_than_expected_

 def it_should_fail_if_actual_is_less_than_expected_():
     with failure(1, 'not to be less or equal to 4'):
         expect(1).not_to.be.less_or_equal_to(4)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:3,代码来源:expect_spec.py

示例14: it_should_fail_if_actual_is_less_than_expected

 def it_should_fail_if_actual_is_less_than_expected():
     with failure(1, 'not to be less than 4'):
         expect(1).not_to.be.less_than(4)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:3,代码来源:expect_spec.py

示例15: it_should_fail_if_actual_is_equal_to_expected

 def it_should_fail_if_actual_is_equal_to_expected():
     with failure(5, 'not to be greater or equal to 5'):
         expect(5).not_to.be.greater_or_equal_to(5)
开发者ID:jvrsantacruz,项目名称:expects,代码行数:3,代码来源:expect_spec.py


注:本文中的spec.helpers.failure函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。