gpt4 book ai didi

python - 有没有像 Ruby 的 Python 机械师这样的东西

转载 作者:太空宇宙 更新时间:2023-11-03 16:39:49 25 4
gpt4 key购买 nike

从网站复制http://github.com/notahat/machinist/

Machinist makes it easy to create test data within your tests. It generates data for the fields you don't care about, and constructs any necessary associated objects, leaving you to only specify the fields you do care about in your tests

A simple blueprint might look like this:

Post.blueprint do  title  { Sham.title }  author { Sham.name }  body   { Sham.body }end

然后您可以使用此蓝图构建一个帖子:

Post.make

When you call make, Machinist calls Post.new, then runs through the attributes in your blueprint, calling the block for each attribute to generate a value. The Post is then saved and reloaded. An exception is thrown if Post can't be saved.

最佳答案

我翻遍了整个Python Testing Tools Taxonomy页面(有很多很棒的东西)但没有找到像 Machinist 这样的东西。

有一个简单的脚本(称为 Peckcheck ),基本上是单元测试和数据生成,但它没有蓝图等......所以你可能会说它只是一个假的:)

关于python - 有没有像 Ruby 的 Python 机械师这样的东西,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1404503/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com