当使用假设库并执行有状态测试时,如何查看或输出库在我的代码上尝试的捆绑包“服务”?你知道吗
示例
import hypothesis.strategies as st
from hypothesis.strategies import integers
from hypothesis.stateful import Bundle, RuleBasedStateMachine, rule, precondition
class test_servicediscovery(RuleBasedStateMachine):
services = Bundle('services')
@rule(target=services, s=st.integers(min_value=0, max_value=2))
def add_service(self, s):
return s
问题是:如何打印/查看库生成的Bundle“services”变量?你知道吗
在您给出的示例中,
services
bundle并没有在您的代码上进行尝试—您正在向其中添加内容,但从未将它们用作另一个规则的输入。你知道吗如果是,在详细模式下运行假设将显示所有发生的输入;或者即使在正常模式下,失败的示例也将打印所有使用的值。你知道吗
相关问题 更多 >
编程相关推荐