我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用factory.fuzzy()。
def generate_data(n_users=25, n_events=100): users = UserFactory.create_batch(size=n_users) models.db.session.bulk_save_objects(users) EventFactory.owner_id = factory.fuzzy.FuzzyInteger(1, n_users) # FIXME: Use a sub-factory or something events = EventFactory.create_batch(size=n_events) models.db.session.bulk_save_objects(events) models.db.session.commit()