我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用factory.Sequence()。
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