python-假设:检索或重新格式化一个伪造的例子
python-hypothesis: Retrieving or reformatting a falsifying example
是否可以在测试失败后检索或重新格式化伪造示例?关键是以不同的格式显示示例数据——策略生成的数据很容易在代码中使用,但对用户来说并不友好,所以我正在研究如何以不同的形式显示它。即使是使用示例数据库的 post-mortem 工具就足够了,但似乎没有任何 API 允许这样做,或者我错过了什么?
您可以在测试期间调用 note
来记录其他信息,例如您自己的生成输入的自定义格式副本。
当 Hypothesis 发现一个伪造的例子时,它还会打印出记录该特定例子执行的注释。
Even a post-mortem tool working with the example database would be enough, but there does not seem to be any API allowing that, or am I missing something?
示例数据库使用私有格式,只记录生成伪造示例的策略选择,因此无法提取示例数据,除非重新运行测试。
Stuart 推荐的 hypothesis.note(...)
不错
是否可以在测试失败后检索或重新格式化伪造示例?关键是以不同的格式显示示例数据——策略生成的数据很容易在代码中使用,但对用户来说并不友好,所以我正在研究如何以不同的形式显示它。即使是使用示例数据库的 post-mortem 工具就足够了,但似乎没有任何 API 允许这样做,或者我错过了什么?
您可以在测试期间调用 note
来记录其他信息,例如您自己的生成输入的自定义格式副本。
当 Hypothesis 发现一个伪造的例子时,它还会打印出记录该特定例子执行的注释。
Even a post-mortem tool working with the example database would be enough, but there does not seem to be any API allowing that, or am I missing something?
示例数据库使用私有格式,只记录生成伪造示例的策略选择,因此无法提取示例数据,除非重新运行测试。
Stuart 推荐的 hypothesis.note(...)
不错