应该-dingus包含自定义匹配,因此您可以使用should_dsl与Dingus调用。
一个小警告:| should_dsl的运营商黑客并没有真正与Dingus的__or __()顺利。我认为|破解是讨厌的,我不知道我喜欢should_dsl它。这是Ruby的似乎真的很给我。
你只需要导入它
>>>从should_dsl进口应should_not
>>>从dingus进口Dingus
>>>进口should_dingus
呼叫
支票上Dingus呼吁
>>>存根= Dingus('存根')
>>>高清some_function():
...存根()
...
>>> some_function |应|调用(存根)
电话还可以检查它应该被称为一次:
>>>高清some_function():
...存根()
...存根()
...
>>> stub.reset()
>>> some_function |应|调用(存根)
>>> stub.reset()
>>> some_function |应|调用(存根)。一旦
回溯(最新最后调用):
...
ShouldNotSatisfied:
打电话甚至可以检查参数与with_params:
>>>高清some_function():
...存根(真,郭某='tuut',braat ='AAP')
...
>>> stub.reset()
>>> some_function |应|调用(存根).with_params(真,郭某='tuut',braat ='AAP')
>>> stub.reset()
>>> some_function |应|调用(存根).with_params(真,郭某='tuut')
回溯(最新最后调用):
...
ShouldNotSatisfied:
呼叫with_params可以一次组合:
>>>高清some_function():
...存根(真,郭某='tuut',braat ='AAP')
...
>>> stub.reset()
>>> some_function |应|调用(存根).once.with_params(真,郭某='tuut',braat ='AAP')
>>> stub.reset()
>>> some_function |应|调用(存根).with_params(真,郭某='tuut',braat ='AAP')一旦
要求:
- 在Python的
评论没有发现