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


Python Spec.should_not_raise方法代码示例

本文整理汇总了Python中lancelot.Spec.should_not_raise方法的典型用法代码示例。如果您正苦于以下问题:Python Spec.should_not_raise方法的具体用法?Python Spec.should_not_raise怎么用?Python Spec.should_not_raise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lancelot.Spec的用法示例。


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

示例1: override_comparators_dont_replace_all

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import should_not_raise [as 别名]
 def override_comparators_dont_replace_all(self):
     ''' comparator overrides only affect comparator used for that type '''
     mock_spec = MockSpec(comparators={float:EqualsEquals})
     mock_call = mock_spec.your_mother(TypeError('hamster'))
     mock_call_result = mock_call.result_of('your_mother')
     spec = Spec(mock_call_result)
     spec.__call__(TypeError('hamster'))
     spec.should_not_raise(UnmetSpecification)
开发者ID:gbremer,项目名称:lancelot,代码行数:10,代码来源:mocking_spec.py

示例2: correct_result_should_be_ok

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import should_not_raise [as 别名]
 def correct_result_should_be_ok(self):
     ''' Specified and_result="bar" and was "bar": met specification.
     Note: and_result refers to the value returned from the callable  
     invoked in verify(), not the return value from the mock. See
     the Hungarian gentleman in the examples for a clearer picture... ''' 
     mock_spec = MockSpec()
     spec = Spec(CollaborateWith(mock_spec.foo().will_return('bar'), 
                                 and_result='bar'))
     spec.verify(lambda: mock_spec.foo())
     spec.should_not_raise(UnmetSpecification)
开发者ID:gbremer,项目名称:lancelot,代码行数:12,代码来源:constraint_spec.py

示例3: should_check_unverified_collaborations

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import should_not_raise [as 别名]
 def should_check_unverified_collaborations(self):
     ''' check for unverified collaborations after start_collaborating '''
     spec = Spec(MockSpec())
     spec.when(spec.foo(), spec.start_collaborating())
     spec.then(spec.verify())
     msg = 'should be collaborating with unnamed_mock.foo()'
     spec.should_raise(UnmetSpecification(msg))
     
     spec = Spec(MockSpec())
     spec.when(spec.foo(), spec.start_collaborating(), spec.foo())
     spec.then(spec.verify())
     spec.should_not_raise(UnmetSpecification)
开发者ID:gbremer,项目名称:lancelot,代码行数:14,代码来源:mocking_spec.py

示例4: verify_exceptions_with_comparator

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import should_not_raise [as 别名]
 def verify_exceptions_with_comparator(self):
     ''' ExceptionValue should be used to verify Exception args '''
     mock_call = MockSpec().your_mother(TypeError('hamster'))
     mock_call_result = mock_call.result_of('your_mother')
     spec = Spec(mock_call_result)
     spec.__call__(TypeError('hamster'))
     spec.should_not_raise(UnmetSpecification)
     
     mock_call = MockSpec().your_father(smelt_of=TypeError('elderberries'))
     mock_call_result = mock_call.result_of('your_father')
     spec = Spec(mock_call_result)
     spec.__call__(smelt_of=TypeError('elderberries'))
     spec.should_not_raise(UnmetSpecification)
开发者ID:gbremer,项目名称:lancelot,代码行数:15,代码来源:mocking_spec.py

示例5: correct_call_should_be_ok

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import should_not_raise [as 别名]
 def correct_call_should_be_ok(self):
     ''' Specified foo() and foo() called: met specification '''
     mock_spec = MockSpec()
     spec = Spec(CollaborateWith(mock_spec.foo()))
     spec.verify(lambda: mock_spec.foo())
     spec.should_not_raise(UnmetSpecification)
开发者ID:gbremer,项目名称:lancelot,代码行数:8,代码来源:constraint_spec.py


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