Python factory 模块,Sequence() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用factory.Sequence()

项目:thecodefellowsnetwork    作者:CodeFN    | 项目源码 | 文件源码
def setUp(self, github_api_call):
        """Set up for backend test runner."""
        self.users = [UserFactory.create() for i in range(5)]
        self.posts = [Post() for i in range(5)]
        for i in range(len(self.posts)):
            self.posts[i].author = self.users[i]
            self.posts[i].title = factory.Sequence(
                lambda n: "Post{}".format(n))
            self.posts[i].save()
        self.comments = [Comment() for i in range(5)]

    # Ben Wednesday